Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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": [
...
like image 816
Kai Walter Avatar asked Oct 16 '25 03:10

Kai Walter


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": [
...
like image 176
Kai Walter Avatar answered Oct 17 '25 18:10

Kai Walter