Welcome to the community @Lucas_Couto
I would make the HTTP request from a function node instead. By default, requiring packages it’s not allowed, but you can enable it by setting env variables below:
export NODE_FUNCTION_ALLOW_BUILTIN=util
export NODE_FUNCTION_ALLOW_EXTERNAL=request
After that, to make a GET request, you can do something similar to:
const request = require('request')
const { promisify } = require('util');
const rq = promisify(request);
const data = await rq({
uri: "https://pokeapi.co/api/v2/pokemon/ditto",
method: 'GET'
})
return [
{
json: JSON.parse(data.body)
}
];
Example workflow
{
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
210,
300
]
},
{
"parameters": {
"functionCode": "// Code here will run only once, no matter how many input items there are.\n// More info and help: https://docs.n8n.io/nodes/n8n-nodes-base.function\nconst request = require('request')\nconst { promisify } = require('util');\nconst rq = promisify(request);\n\n\nconst data = await rq({\nuri: \"https://pokeapi.co/api/v2/pokemon/ditto\",\nmethod: 'GET'\n})\nreturn [\n {\n json: JSON.parse(data.body)\n }\n];"
},
"name": "Function",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
840,
170
]
}
],
"connections": {
"Start": {
"main": [
[
{
"node": "Function",
"type": "main",
"index": 0
}
]
]
}
}
}
Of course, at all that is assuming that you are self-hosting. If you are using n8n cloud, you do not need to set the env variables.
With regards to not being able to sent a body when doing a GET request. We are aware of that limitation as it’s something that we would include in the version 2 of the node.