Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
samuelfeldt
Frequent Visitor

PowerQuery Web Scenario: GET API, Header api key, Content Body

It appears that you are unable to use PowerQuery in a Scenario where you need:

  • GET HTTP Method
  • Header API Key
  • Content Body
let 
Url="url",
header = [#"x-api-key"="xxxx",#"Content-Type"= "application/json"],
Query="querystring",
body=[encoded_query=Query],

response = Web.Contents(Url, [Headers=header, Content=Json.FromValue(body)]),
Source = Json.Document(response)
in Source

^This design with Anonymous credential returns an "Expression.Error: Access to the resource is forbidden." indicating it does not read the header.

 

let 
Url="url",
header = [#"x-api-key"="xxxx",#"Content-Type"= "application/json"],
Query="querystring",

apiKeyName="x-api-key",
body=[encoded_query=Query],

response = Web.Contents(Url, [Headers=header, ApiKeyName=apiKeyName, Content=Json.FromValue(body)]),
Source = Json.Document(response)
in Source

^This design with Web API credential returns an "DataSource.Error: Web.Contents with the Content option is only supported when connecting anonymously. Details: DataSourceKind=Web, DataSourcePath=url" indicating I cannot supply a Web API Credential with a Content body.

 

let 
Url="url",
header = [#"x-api-key"="xxxx", #"Content-Type"= "application/json"],
Query="querystring",
body=[encoded_query=Query],

response = WebAction.Request(WebMethod.Get, Url, [Headers=header, Content=Json.FromValue(body)]),
Source = Json.Document(response)
in Source

^This design with any credential returns an "Expression.Error: We haven't been given permission to perform actions against this resource." indicating WebAction.Request does not force the method to GET.

 

This combination is the only valid scenario to request this API.

Any thoughts?

3 REPLIES 3
lbendlin
Super User
Super User

That is correct. As soon as you specify a content body Power Query will automatically change from GET to POST.

Went ahead and submitted an idea. Not sure what the purpose of forcing to POST is.

 

https://ideas.powerbi.com/ideas/idea/?ideaid=2d5b9bd6-cc43-ec11-a3ee-501ac524503c

There's a big can of worms over there... you could argue the same for PATCH etc.  Power Query only provides minimal HTTP request support.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.