# Using an variable (array) in HTTP request

**URL:** <https://community.n8n.io/t/using-an-variable-array-in-http-request/6125>\
**Category:** Questions\
**Tags:** node\
**Created:** [June 3, 2021, 11:29am UTC](https://community.n8n.io/t/using-an-variable-array-in-http-request/6125 "2021-06-03T11:29:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cvrooij](https://avatars.discourse-cdn.com/v4/letter/c/e274bd/32.png) [@cvrooij](https://community.n8n.io/u/cvrooij)\
**Post date:** [June 3, 2021, 11:29am UTC](https://community.n8n.io/t/using-an-variable-array-in-http-request/6125/1 "2021-06-03T11:29:07Z")

</div>

Hi,

so I’m trying to make a http request with a variable in the url, but the http request don’t work. I want to use the product\_id from function2 in the second request but it keeps throwing out errors. Is the array from function2 the problem? How do I use them in the right way? If I just put in the data in the request without an expression, I get the information I want, so the url itself isn’t the problem. The workflow should get all unfulfilled orders since yesterday and search for the products. Here’s my workflow:

I’m new to all of this, please excuse mistakes in my workflow… 😅  
Thanks for your answers!

---

<div class="post-metadata">

**Author:** ![harshil1712](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/harshil1712/32/1374_2.png) [@harshil1712](https://community.n8n.io/u/harshil1712)\
**Post date:** [June 3, 2021, 11:45am UTC](https://community.n8n.io/t/using-an-variable-array-in-http-request/6125/2 "2021-06-03T11:45:31Z")

</div>

Hey @cvrooij!

Welcome to the community 💖

Is there a specific reason you’re using the HTTP Request node to fetch the products, instead of the [Shopify node](https://docs.n8n.io/nodes/n8n-nodes-base.shopify)?

Can you also share the output of the Function2 node? Feel free to replace any sensitive information with dummy data.

---

<div class="post-metadata">

**Author:** ![cvrooij](https://avatars.discourse-cdn.com/v4/letter/c/e274bd/32.png) [@cvrooij](https://community.n8n.io/u/cvrooij)\
**Post date:** [June 3, 2021, 12:22pm UTC](https://community.n8n.io/t/using-an-variable-array-in-http-request/6125/3 "2021-06-03T12:22:35Z")

</div>

Hey @harshil1712!

Thanks for your answer and the welcomes! How do I mark my workflow like you did in the edit? 🤔

No there’s no reason, I just forgot about the shopify node… 🤦🏻‍♂️  
I switched the http nodes with the shopify node and the output data of the first shopify node is exactly the output data of function2, so function2 was only necessary with the http node I think. In general I add “created at min - yesterday” to the first shopify node but I left it out, to have some data I can work with. so the first function node is irrelevant for my problem I think.  
My new workflow looks like this:

But it keeps showing an error message in the second node:

```
ERROR: Shopify error response [400]: expected String to be a id

Error: Shopify error response [400]: expected String to be a id
at Object.shopifyApiRequest (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Shopify/GenericFunctions.js:44:19)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Shopify/Shopify.node.js:270:36)
at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:416:47

```

I also got this error message sometimes with the http request node. The output data of the shopify node is an array with 9 items. I will post one item:

```
[
{

"id": 3782799229086,

"admin_graphql_api_id": "gid://shopify/Order/3782799229086",

"app_id": xx,

"browser_ip": "xx",

"buyer_accepts_marketing": false,

"cancel_reason": null,

"cancelled_at": null,

"cart_token": "xxx",

"checkout_id": 21272018911390,

"checkout_token": "xxx",

"client_details": {

"accept_language": "de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7",

"browser_height": 907,

"browser_ip": "xxx",

"browser_width": 1680,

"session_hash": null,

"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36"

},

"closed_at": null,

"confirmed": true,

"contact_email": "e-mail",

"created_at": "2021-05-03T12:05:58+02:00",

"currency": "EUR",

"current_subtotal_price": "49.50",

"current_subtotal_price_set": {

"shop_money": {

"amount": "49.50",

"currency_code": "EUR"

},

"presentment_money": {

"amount": "49.50",

"currency_code": "EUR"

}

},

"current_total_discounts": "0.00",

"current_total_discounts_set": {

"shop_money": {

"amount": "0.00",

"currency_code": "EUR"

},

"presentment_money": {

"amount": "0.00",

"currency_code": "EUR"

}

},

"current_total_duties_set": null,

"current_total_price": "51.70",

"current_total_price_set": {

"shop_money": {

"amount": "51.70",

"currency_code": "EUR"

},

"presentment_money": {

"amount": "51.70",

"currency_code": "EUR"

}

},

"current_total_tax": "3.59",

"current_total_tax_set": {

"shop_money": {

"amount": "3.59",

"currency_code": "EUR"

},

"presentment_money": {

"amount": "3.59",

"currency_code": "EUR"

}

},

"customer_locale": "xx",

"device_id": null,

"discount_codes": [

],

"email": "xx",

"financial_status": "paid",

"fulfillment_status": null,

"gateway": "xx",

"landing_site": "/products/geschichte-der-wietzendorfer-hofe",

"landing_site_ref": null,

"location_id": null,

"name": "#xx",

"note": "",

"note_attributes": [

],

"number": 293,

"order_number": xx,

"order_status_url":"xxx",

"original_total_duties_set": null,

"payment_gateway_names": [

"paypal"

],

"phone": null,

"presentment_currency": "EUR",

"processed_at": "2021-05-03T12:05:57+02:00",

"processing_method": "express",

"reference": null,

"referring_site": "https://www.google.com/",

"source_identifier": null,

"source_name": "web",

"source_url": null,

"subtotal_price": "49.50",

"subtotal_price_set": {

"shop_money": {

"amount": "49.50",

"currency_code": "EUR"

},

"presentment_money": {

"amount": "49.50",

"currency_code": "EUR"

}

},

"tags": "xxx",

"tax_lines": [

{

"price": "3.24",

"rate": 0.07,

"title": "DE MwSt",

"price_set": {

"shop_money": {

"amount": "3.24",

"currency_code": "EUR"

},

"presentment_money": {

"amount": "3.24",

"currency_code": "EUR"

}

}

},

{

"price": "0.35",

"rate": 0.19,

"title": "DE MwSt",

"price_set": {

"shop_money": {

"amount": "0.35",

"currency_code": "EUR"

},

"presentment_money": {

"amount": "0.35",

"currency_code": "EUR"

}

}

}

],

"taxes_included": true,

"test": false,

"token": "xx",

"total_discounts": "0.00",

"total_discounts_set": {

"shop_money": {

"amount": "0.00",

"currency_code": "EUR"

},

"presentment_money": {

"amount": "0.00",

"currency_code": "EUR"

}

},

"total_line_items_price": "49.50",

"total_line_items_price_set": {

"shop_money": {

"amount": "49.50",

"currency_code": "EUR"

},

"presentment_money": {

"amount": "49.50",

"currency_code": "EUR"

}

},

"total_outstanding": "0.00",

"total_price": "51.70",

"total_price_set": {

"shop_money": {

"amount": "51.70",

"currency_code": "EUR"

},

"presentment_money": {

"amount": "51.70",

"currency_code": "EUR"

}

},

"total_price_usd": "62.15",

"total_shipping_price_set": {

"shop_money": {

"amount": "2.20",

"currency_code": "EUR"

},

"presentment_money": {

"amount": "2.20",

"currency_code": "EUR"

}

},

"total_tax": "3.59",

"total_tax_set": {

"shop_money": {

"amount": "3.59",

"currency_code": "EUR"

},

"presentment_money": {

"amount": "3.59",

"currency_code": "EUR"

}

},

"total_tip_received": "0.00",

"total_weight": 0,

"updated_at": "2021-05-03T12:06:10+02:00",

"user_id": null,

"billing_address": {

"first_name": "xx",

"address1": "xx xx",

"phone": null,

"city": "xx",

"zip": "xx",

"province": null,

"country": "xx",

"last_name": "xx",

"address2": "xx",

"company": null,

"latitude": xx,

"longitude": xx,

"name": "xx",

"country_code": "xx",

"province_code": null

},

"customer": {

"id": 5221130600606,

"email": "xx",

"accepts_marketing": false,

"created_at": "2021-05-03T12:03:06+02:00",

"updated_at": "2021-05-03T12:05:58+02:00",

"first_name": "xx",

"last_name": "xx",

"orders_count": 1,

"state": "disabled",

"total_spent": "51.70",

"last_order_id": 3782799229086,

"note": null,

"verified_email": true,

"multipass_identifier": null,

"tax_exempt": false,

"phone": null,

"tags": "",

"last_order_name": "#1293",

"currency": "EUR",

"accepts_marketing_updated_at": "2021-05-03T12:03:06+02:00",

"marketing_opt_in_level": null,

"tax_exemptions": [

],

"admin_graphql_api_id": "gid://shopify/Customer/5221130600606",

"default_address": {

"id": 6389405286558,

"customer_id": 5221130600606,

"first_name": "xx",

"last_name": "xx",

"company": null,

"address1": "xx",

"address2": "xx",

"city": "xx",

"province": null,

"country": "xx",

"zip": "xx",

"phone": null,

"name": "xx",

"province_code": null,

"country_code": "xx",

"country_name": "xx",

"default": true

}

},

"discount_applications": [

],

"fulfillments": [

],

"line_items": [

{

"id": 9848049762462,

"admin_graphql_api_id": "gid://shopify/LineItem/9848049762462",

"fulfillable_quantity": 1,

"fulfillment_service": "manual",

"fulfillment_status": null,

"gift_card": false,

"grams": 0,

"name": "Geschichte der Wietzendorfer Höfe",

"origin_location": {

"id": 1882484637755,

"country_code": "DE",

"province_code": "",

"name": "Böhme.Shop",

"address1": "xx",

"address2": "",

"city": "xx",

"zip": "xx"

},

"price": "49.50",

"price_set": {

"shop_money": {

"amount": "49.50",

"currency_code": "EUR"

},

"presentment_money": {

"amount": "49.50",

"currency_code": "EUR"

}

},

"product_exists": true,

**"product_id": 4799719145531,**

"properties": [

],

"quantity": 1,

"requires_shipping": true,

"sku": null,

"taxable": true,

"title": "Geschichte der Wietzendorfer Höfe",

"total_discount": "0.00",

"total_discount_set": {

"shop_money": {

"amount": "0.00",

"currency_code": "EUR"

},

"presentment_money": {

"amount": "0.00",

"currency_code": "EUR"

}

},

"variant_id": 33348532699195,

"variant_inventory_management": null,

"variant_title": "",

"vendor": "Böhme-Zeitung",

"tax_lines": [

{

"price": "3.24",

"price_set": {

"shop_money": {

"amount": "3.24",

"currency_code": "EUR"

},

"presentment_money": {

"amount": "3.24",

"currency_code": "EUR"

}

},

"rate": 0.07,

"title": "DE MwSt"

}

],

"duties": [

],

"discount_allocations": [

]

}

],

"refunds": [

],

"shipping_address": {

"first_name": "xx",

"address1": "xx",

"phone": null,

"city": "xx",

"zip": "xx",

"province": null,

"country": "xx",

"last_name": "xx",

"address2": "xx",

"company": null,

"latitude": 50.9205167,

"longitude": 6.4095361,

"name": "xx",

"country_code": "DE",

"province_code": null

},

"shipping_lines": [

{

"id": 3213070696606,

"carrier_identifier": null,

"code": "Buchversand",

"delivery_category": null,

"discounted_price": "2.20",

"discounted_price_set": {

"shop_money": {

"amount": "2.20",

"currency_code": "EUR"

},

"presentment_money": {

"amount": "2.20",

"currency_code": "EUR"

}

},

"phone": null,

"price": "2.20",

"price_set": {

"shop_money": {

"amount": "2.20",

"currency_code": "EUR"

},

"presentment_money": {

"amount": "2.20",

"currency_code": "EUR"

}

},

"requested_fulfillment_service_id": null,

"source": "shopify",

"title": "Buchversand",

"tax_lines": [

{

"price": "0.35",

"price_set": {

"shop_money": {

"amount": "0.35",

"currency_code": "EUR"

},

"presentment_money": {

"amount": "0.35",

"currency_code": "EUR"

}

},

"rate": 0.19,

"title": "DE MwSt"

}

],

"discount_allocations": [

]

}

]

},

{... next order

```

the marked (\*\*) “product id” is the data I need for the following shopify node.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![harshil1712](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/harshil1712/32/1374_2.png) [@harshil1712](https://community.n8n.io/u/harshil1712)\
**Post date:** [June 3, 2021, 2:11pm UTC](https://community.n8n.io/t/using-an-variable-array-in-http-request/6125/4 "2021-06-03T14:11:42Z")

</div>

Hey!  
Can you please check the format of the output data you posted? It doesn’t seem to be correct.

I also noticed that in the Shopify1 node you’re trying to get the Product ID from a Set node, but there is no Set node present in your workflow.

You can refer to the video shared here to know how you can format the code in your post: [How can I contribute? | Docs](https://docs.n8n.io/reference/contributing.html#help-out-the-community-%F0%9F%A4%9D)

---

<div class="post-metadata">

**Author:** ![cvrooij](https://avatars.discourse-cdn.com/v4/letter/c/e274bd/32.png) [@cvrooij](https://community.n8n.io/u/cvrooij)\
**Post date:** [June 3, 2021, 2:39pm UTC](https://community.n8n.io/t/using-an-variable-array-in-http-request/6125/5 "2021-06-03T14:39:36Z")

</div>

> [@harshil1712](#):
>
> Can you please check the format of the output data you posted? It doesn’t seem to be correct.

sorry, but I’m not sure which output data you mean… 😫

> [@harshil1712](#):
>
> I also noticed that in the Shopify1 node you’re trying to get the Product ID from a Set node, but there is no Set node present in your workflow.

Yeah, I tried different ways to give the data to the shopify1 node through set (string/number) and after it didn’t worked, I forgot to change it before copying it for this post here. In my first try I used:

```
{
"nodes": [
{
  "parameters": {
    "resource": "product",
    "operation": "get",
    "productId": "={{$node[\"Shopify\"].json[\"line_items\"][0][\"product_id\"]}}",
    "additionalFields": {}
  },
  "name": "Shopify1",
  "type": "n8n-nodes-base.shopify",
  "typeVersion": 1,
  "position": [
    1180,
    400
  ],
  "credentials": {
    "shopifyApi": "Böhme.Shop"
  }
}
],
"connections": {}
}

```

---

<div class="post-metadata">

**Author:** ![harshil1712](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/harshil1712/32/1374_2.png) [@harshil1712](https://community.n8n.io/u/harshil1712)\
**Post date:** [June 10, 2021, 9:50am UTC](https://community.n8n.io/t/using-an-variable-array-in-http-request/6125/6 "2021-06-10T09:50:00Z")

</div>

Hey! Sorry I missed your reply. Were you able to solve this? If you still need help, let me know 🙂

---

<div class="post-metadata">

**Author:** ![cvrooij](https://avatars.discourse-cdn.com/v4/letter/c/e274bd/32.png) [@cvrooij](https://community.n8n.io/u/cvrooij)\
**Post date:** [July 26, 2021, 1:31pm UTC](https://community.n8n.io/t/using-an-variable-array-in-http-request/6125/7 "2021-07-26T13:31:01Z")

</div>

Hey! Sorry I missed your reply too! 😅 🙈 Yes, I was able to solve the problem. I’m not sure what I’ve changed back then, but it’s working fine now. Thanks for your help! @harshil1712
