Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Frequent Visitor

Web.Contents return application/octet-stream instead of application/json with 403



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? 




New Member

Hey. I have same problem. Do you resolve it? Please let me know if you done it.

Resident Rockstar
Resident Rockstar

Hi @storm-nhaab - 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

Helpful resources

PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors