Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi,
I have written an M function that sends a post request to a API. I want to implement some error handling
when sending an incorrect parameter. When I do that the API should return a 403 status code
but for some reason the response that is returned from" Web.Contents()" is of the type "application/octet-stream" with a response that is "null", when it should be a JSON response with a 403 status code.
headers = [#"Content-Type" = "application/json", #"Accept" = "application/json"],
response = Web.Contents(url, [
Headers = headers,
Content = postData
])
In Postman, Python, Curl etc. it works fine and the API returns the expected json package with the 403 error.
This is the meta data which is returned:
I can catch the null response but that is not a nice solution. The proper 403 code should be handled.
Has anybody else experienced this?
Sincerely,
Nicolai
Hey. I have same problem. Do you resolve it? Please let me know if you done it.
Hi @Anonymous - you could consider using the Web.Headers - PowerQuery M | Microsoft Learn function to grab the header only. Here a recent Blog about the feature. New Web.Headers M function | Microsoft Power Query
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
24 | |
12 | |
11 | |
11 | |
8 |
User | Count |
---|---|
43 | |
25 | |
15 | |
14 | |
12 |