# Query string in HTTP Get Request

**URL:** <https://discourse.nodered.org/t/query-string-in-http-get-request/77218>\
**Category:** General\
**Tags:** http-request\
**Created:** [3 April 2023 23:19 UTC](https://discourse.nodered.org/t/query-string-in-http-get-request/77218 "2023-04-03T23:19:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sepdoce90](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sepdoce90/32/78330_2.png) [@sepdoce90](https://discourse.nodered.org/u/sepdoce90)\
**Post date:** [3 April 2023 23:19 UTC](https://discourse.nodered.org/t/query-string-in-http-get-request/77218/1 "2023-04-03T23:19:37Z")

</div>

I'm trying to add a Query string the url from a payload response, but kind of stuck. Any help is much appreciated. object

Response Debug

 ![Screenshot from 2023-04-03 20-18-45](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/9/d978a70a22c978f0dff405b186040b9f2c3dc548.png)

\_msgid: "1db80dc515d48aaf"

payload: object

headers: object

query: "var query = msg.payload.dealReference↵return msg.↵"

statusCode: 400

responseUrl: "[https://demo-api-capital.backend-capital.com/api/v1/confirms/var%20query%20=%20msg.payload.dealReferencereturn%20msg.](https://demo-api-capital.backend-capital.com/api/v1/confirms/var%20query%20=%20msg.payload.dealReferencereturn%20msg.)"

redirectList: array[0]

retry: 0

Template node ;  
var query = msg.payload.dealReference  
return msg.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [4 April 2023 00:27 UTC](https://discourse.nodered.org/t/query-string-in-http-get-request/77218/2 "2023-04-04T00:27:10Z")

</div>

To pass a query string to a request node, you need to add the query to the URL. So the input msg needs to have a `msg.url` (which you could build dynamically by using JSONata in a change node) or you can specify the URL in the node and use mustache style variables:

```auto
https://demo-api-capital.backend-capital.com/api/v1/confirms/{{{payload.dealReference}}}

```

Note that `msg.` is not supplied in the mustache variables. Also note that using double brackets `{{...}}` would man that mustache would escape any characters that would be mis-interpreted as HTML which is why triple-brackets are needed.

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [4 April 2023 01:35 UTC](https://discourse.nodered.org/t/query-string-in-http-get-request/77218/3 "2023-04-04T01:35:32Z")

</div>

Category changed to general, as this post is not about creating nodes.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [3 June 2023 01:36 UTC](https://discourse.nodered.org/t/query-string-in-http-get-request/77218/4 "2023-06-03T01:36:30Z")

</div>

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