Query string in HTTP Get Request

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

_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."

redirectList: array[0]

retry: 0

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

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:

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.

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

1 Like

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