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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Web.Contents using Get method and passing RequestBody

I am trying to call 3rd party Web.Content Get method , it requires a json parameter.   

My code is:
header = [#"Content-Type"="application/json", #"Authorization"="Bearer " & #"GetAccessToken"()]
request = Web.Contents(url,[Headers=header,Query=[method="get", Content="application/json", body=query2, ParameterType="RequestBody"]])
 
Postman has C# RestSharp has 
request.AddParameter("application/json", body,  ParameterType.RequestBody);
 
Fiddler shows:   "errors":{"":["A non-empty request body is required."]}. 
 
Is there a way to set ParameterType as RequestBody and pass in Web.Contents call?     If not, any other suggestions?
3 REPLIES 3
v-kelly-msft
Community Support
Community Support

 Hi  @Anonymous ,

 

Check below thread for help:

https://community.powerbi.com/t5/Desktop/add-json-parameters-in-advance-query-editor-Json-Document-Web/td-p/1065372

 

Best Regards,
Kelly

Did I answer your question? Mark my raeply as a solution!

Anonymous
Not applicable

Sorry, but no your response did not answer my question.  I am asking how to include json in a Request Body of GET api.   Other replies have stated this is not possible. 

Thanks

lbendlin
Super User
Super User

"I am trying to call 3rd party Web.Content Get method , it requires a json parameter.  "

 

That is not possible with a GET request. You need to use a POST request by encoding your JSON payload into the Content attribute of the request.

Web.Contents - PowerQuery M | Microsoft Docs

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors