How can I send a POST request with --data required?

Describe the problem/error/question

I need to send a POST request equivalent to this curl command:

curl --request POST \                                                                                                                    
  --url https://target-server/api/v2/get/page \
  --header 'Accept: application/json, application/problem+json' \
  --header 'Authorization: MyToken' \
  --header 'Content-Type: application/json' \
  --data '{
  "filterSets": [
    {
      "filterCombineOr": false,
      "filters": [
        {
          "field": "email",
          "operator": "eq",
          "value": null
        }
      ]
    }
  ],
  "includeInactives": false,
  "limit": 100,
  "order": "createdAt",
  "orderDescending": false
}'

I am trying to achieve this with a Request node, but I need to send the --data and don’t know how to do it. Where or how should I specify it within the request node?

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.73.1
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): cloud
  • Operating system:

n8n’s http node actually has an amazing feature that i use all the time…the little button on the top right “Import cURL”

You can paste your curl command in the popup window and will set the node to be the same thing as the curl command does!


To answer your question, the --data is the same thing as the JSON body in the http node. So if you add it like this then it will work for you

2 Likes

That’s such a nice feature! Thanks a lot @liam !

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.