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
nathan2399
New Member

PUT request using WebAction.Request

I've been trying to setup a simple PUT request to an API with no success. The API itself works as intended, used Postman to request the data. GET/POST requests are working fine with PowerQuery.

 

let

  BaseUrl = "https://stackoverflow-63122537.herokuapp.com/demo"
  BaseHeaders = [#"Content-Type"="application/json"],
  JsonBody = Json.FromValue([A = 1, B = 2]),

  Count = 
    WebAction.Request(
      "PUT",
      BaseUrl,
        [
          Headers = [ BaseHeaders ],
          Content = JsonBody
        ]
    )
  
in
  Count

Expected:

Count should return a number.


Actual result:

PowerBI reports "Object reference not set to an instance of an object"

2 REPLIES 2
pranit828
Community Champion
Community Champion

Hi @nathan2399 

 

As the URI in a POST request identifies the resource that will handle the enclosed entity... In contrast, the URI in a PUT request identifies the entity enclosed with the request, i would go witht the POST Request.

 

Did I resolve your issue? Mark my post as a solution! Appreciate your Kudos, Press the thumbs up button!!

 

Regards,
Pranit

 





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

Thanks for the input Pranit, and I would if I could but sadly the API uses POST for other ops while PUT returns counts (for some reason).

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.