Curl function not working in Apache Nifi using the ExecuteProcess and --data-binary tag

424 Views Asked by At

I am having a problem with using the ExecuteProcess with a curl command using the --data-binary tag. When I run this command in the terminal it works:

curl https://api.webflow.com/collections/5f7146cacb2fc106ad4c0386/items/ \
-H "Authorization: Bearer bce8078f0495fc47a5e9d2534f25e1335d0aa316601c2fc9971b169f1aeadc17" \
-H "accept-version: 1.0.0" \
-H "Content-Type: application/json" \
--data-binary $'{
"fields": {
"name": "Exciting blog post title",
"slug": "exciting-post",
"_archived": false,
"_draft": false

}
}'

However, when I run it as an ExcecuteProcess in NiFi, it returns the following error:

{
  "msg": "Invalid request body",
  "code": 400,
  "name": "ValidationError",
  "path": "/collections/5f7146cacb2fc106ad4c0386/items",
  "err": "ValidationError: Invalid request body"
}

Here's a link to the WebFlow documentation to the for the createItem curl command: https://developers.webflow.com/#create-new-collection-item

Any help someone can give me that would be great. If I should use another processor to make these types of requests that would be awesome.

1

There are 1 best solutions below

0
Mike Thomsen On

Simple solution here would be to wrap it in a shell script (or PowerShell/BAT file on Windows) and call that script.