Skip to main content

Notifications

Power Automate - Power Automate Desktop
Suggested answer

Having Trouble Passing JSON Data via Invoke Web Service

(3) ShareShare
ReportReport
Posted on by 65
I'm having problems using the Invoke Web Request step. I have this AI generated cURL command that works as expected [1]:
curl -X POST https://adb-<workspaceId>.azuredatabricks.net/api/2.0/sql/statements/ \
-H "Authorization: Bearer <myPersonalAccessToken>" \
-H "Content-Type: application/json" \
-d '{
  "warehouse_id": "<myWareHouseId>",                                                                                     
  "catalog": "hive_metastore",                                                                                            
  "schema": "dev.bronze",                                                                                              
  "statement": "SELECT * FROM dev.bronze.shawn_test_table;"
}'
Unfortunately, I can't get it to work correctly in Power Automate (See Picture Below):

When I run the Power Automate debugger and stop in the Set Variable step, I see that my WebServiceRequest variable was set to the value:
{"error_code":"MALFORMED_REQUEST","message":"Invalid JSON given in the body of the request - failed to parse given JSON"}

This implies that the Invoke Web Service request step failed. I suspect the problem is that I'm not formatting my JSON the way Power Automate wants me to in the Request Body field of the Invoke Web Service dialog. When I use the real values for <myPersonalAccessToken> , <workspaceId> and <myWareHouseId> my JSON is valid, but I do have a few questions:
  1. Does Power Automate require me to format the JSON for my Request Body in some special manner?
  2. Am I using the proper method to pass JSON via Invoke Web Service?
If you are interested, you can also see a slightly modified version of this question here on StackOverflow (SO):
https://stackoverflow.com/questions/78903351/how-do-i-pass-json-data-in-the-desktop-version-of-power-automate

[1] - The query has been sanitized to remove sensitive data prior to posting here and on SO.
Categories:
  • Suggested answer
    shawn_eary Profile Picture
    shawn_eary 65 on at
    Having Trouble Passing JSON Data via Invoke Web Service
    I was talking with MS Copilot and it suggested I check the Encode Request Body switch and turn it on. It was already on. It turned it off and the code started working.

    Apparently, the setting was on by default in my code.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,691

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 65,019

Leaderboard