How can I submit the same GUID multiple times in a Visual Studio Code REST Client request

Viewed 21

When I need to use the same GUID in several instances - e.g. HTTP Header and Body - how can I achieve this?

Doing it like this generates multiple GUIDs:

...
###
POST https://host.acme.com/someapi
Content-Type: application/json; charset=UTF-8
Correlation-Id: {{$guid}}

{
  "CorrelationId": "{{$guid}}",
  "Record": [
...
1 Answers

This can be achieved by defining and using a variable

...
###
@corrid = {{$guid}}
POST https://host.acme.com/someapi
Content-Type: application/json; charset=UTF-8
Correlation-Id: {{corrid}}

{
  "CorrelationId": "{{corrid}}",
  "Record": [
...
Related