Curl command running normal but import to http-request by "import curl" not working

Describe the issue/error/question

I have a curl command like this:

curl -H "Authorization: Token f651b0fb62978961b68e1bf8d740647d2fc4be8" -H 'Accept: application/json; indent=4' "https://demo.seafile.top/api/v2.1/admin/logs/file-update/?start=2019-07-30&end=2019-07-31"

When running on my server, response is:

{
    "detail": "Invalid token"
}

What is the error message (if any)?

But when using http-request note by “import curl” not working, it shows error:

{"status":"rejected","reason":{"message":"301 - \"\"","name":"Error","stack":"Error: 301 - \"\"\n    at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15)\n    at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12)\n    at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11)\n    at IncomingMessage.emit (node:events:525:35)\n    at IncomingMessage.emit (node:domain:552:15)\n    at endReadableNT (node:internal/streams/readable:1358:12)\n    at processTicksAndRejections (node:internal/process/task_queues:83:21)"}}

Please share the workflow

This is my workflow

Information on your n8n setup

  • n8n version: 0.219.1
  • Database you’re using (default: SQLite): SQLite
  • Running n8n with the execution process [own(default), main]: own
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

Please show me how to fix this? Thanks!

Hey @huuich,

A 301 typically indicates a redirect is trying to happen and I don’t think we follow them by default which Curl does, If you go to Add Options > Redirects and Enable the follow option it will show the same message.

2 Likes

Thank you, Apologies for my ignorance on using the import curls feature. Now the result is out as I expected.

1 Like

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