Http Node Error 400

Hi! I am trying to access Twitter Data through API using the HTTP Node because apparently there’s only limited data I can fetch with the Twitter API Node. I am always getting the Error 400 as a response whereas, when I try running the URL with POSTMAN, it works fine. Any idea why is this happening?

Sorry sadly not, is impossible to answer without more information. But if it works with POSTMAN but not n8n it seems like the HTTP Request node in n8n did not get configured correctly. Can you please share the node with me and a link to the documentation of the Twitter-Endpoint you want to use. I can then have a look. Thanks!

Endpoint would be: https://api.twitter.com/1.1/followers/list.json?user_id={user_id}
Authorization: Bearer Token

The documentation’s right here! Thanks @jan

https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-followers-list

I just tried to make a request with this node and for me it returns a result just fine:

{
  "nodes": [
    {
      "parameters": {
        "authentication": "oAuth1",
        "url": "https://api.twitter.com/1.1/followers/list.json",
        "options": {},
        "queryParametersUi": {
          "parameter": [
            {
              "name": "user_id",
              "value": "janoberhauser"
            }
          ]
        }
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        450,
        300
      ],
      "credentials": {
        "oAuth1Api": ""
      }
    }
  ],
  "connections": {}
}
1 Like

Copying your node did a pretty great improvement on what I am trying to do. now the only problem is with the Callback URL. It always says that my localhost refuses to connect. :smiley: Any idea why? THanks for the very big help!

Sadly not. If you visit http://localhost:5678 does n8n open?

Apparently, no. :frowning:

I think since my n8n is installed to a different server thats why it pops this issue. since I am just copying the Callback URL from n8n and pasting it maybe it is not the right one. So is there a way i could change/customize the callback URL?

Yes, you can change the webhook URL:
https://docs.n8n.io/reference/configuration.html#webhook-url

Generally do we recommend to follow this guide when setting n8n up on a server:
https://docs.n8n.io/reference/server-setup.html#_5-create-docker-compose-file

1 Like

But wouldn’t I be able to customize it just for this instance? :smiley: For I don’t have direct access on the server and I am just accessing this Host URL. I mean declare what would be the callback URL and input the URL where my n8n is installed and pass it on Twitter as an approved callback URL.

With that environment variable you can change the callback URL for only for this instance.
But to do that you have to set it via that environment variable. There is no other way to do that as there is only one correct value that will not change. For that reason does it have to be configured correctly on the server and can not be overwritten via the Editor-UI. If it is not set up that way, n8n will not work correctly (as it is not configured correctly). For example will literally none of the third part Trigger Nodes work.

So it is important to set this and all other values correctly (as described in the Server-Setup-Guide).

1 Like

Okay, got it! Thank you so much @jan!