Search code examples
curlazure-databrickslowcode

How Do I Pass JSON Data in the Desktop Version of Power Automate?


This sanitized cURL query works fine [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, when I try to put the cURL command into the desktop version of Power Automate, I get the error:
{"error_code":"MALFORMED_REQUEST","message":"Invalid JSON given in the body of the request - failed to parse given JSON"}

My Parameters for Power Automate Invoke Web Service

What am I doing wrong in Power Automate?

[1] - Various AI engines helped write that query.
[2] - See Also: Arrogant Sage Media, "Power Automate Desktop - Connect to API, Read & Process JSON & Create and Post JSON", YouTube: https://www.youtube.com/watch?v=RSWqw8kJYrw , June 14, 2023, Last Visited: August 23, 2024


Solution

  • Eventually, Microsoft Copilot clued me in on the problem by telling me more than once to check the "Encode Request Body" option. It suggested that I turn the option on, but ironically, the solution was to turn the feature off. enter image description here

    You will find the "Encode request body" switch in the Advanced section on the current version of Power Automate.

    The setting was apparently on by default for my program.