This page shows an example of Variable Insertion in using stream consisting of the HTTP Client function.
...
Enter the JS code using the Script function. Example of a JS code snippet:
No Format await push({ url: 'https://postman-echo.com', foo: 42, bar: 'kawaboom!', baz: payload.value % 2, someData: { alpha: 1337, beta: 'foobar' } })
Configure an HTTP request response in the following format. You can substitute the values of variables defined in the JS code snippet using ${variable} or @{variable}.
Note title Note! While configuring HTTP body, you must add the JSON objects within quotes (" ") . Applicable only for JSON objects that return value in the string format.
Expand title Example: Code Block { "comp": "dr", "dept": "pm", "score": 100, "name": "@{payload.name}", "age": "@{payload.age}" }
You will receive the following httpResponse:
httpResponse.json.age httpResponse.json.comp httpResponse.json.dept httpResponse.json.name httpResponse.json.score <age> dr pm <name> 100 However, if you do not use " " with ${name} or ${age} or both, then you will see the httpResponse in the string format as shown below:
httpResponse.json
{ "age": 18, "comp": "dr", "dept": "pm", "score": 100, "name": "jason" }
...