# HTTP Request GET with body

**URL:** <https://community.n8n.io/t/http-request-get-with-body/6249>\
**Category:** Questions\
**Created:** [June 11, 2021, 7:11pm UTC](https://community.n8n.io/t/http-request-get-with-body/6249 "2021-06-11T19:11:51Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![RicardoE105](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ricardoe105/32/550_2.png) [@RicardoE105](https://community.n8n.io/u/RicardoE105)\
**Post date:** [June 11, 2021, 7:47pm UTC](https://community.n8n.io/t/http-request-get-with-body/6249/2 "2021-06-11T19:47:30Z")

</div>

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:

```auto
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.

> **[Configuration methods | n8n Docs](https://docs.n8n.io/hosting/environment-variables/configuration-methods/)**
>
> How to set environment variables for n8n.

---

_[View the full topic](https://community.n8n.io/t/http-request-get-with-body/6249)._
