What is {{$guid}} used for in Postman?

Nurlan Mirzayev picture Nurlan Mirzayev · Jun 16, 2016 · Viewed 33.1k times · Source

Postman's official website states that Postman has a few dynamic variables. My question is about:

{{$guid}}: Adds a v4 style guid

What kind of variable is {{$guid}}? How can it be used in test scripts for API requests?

Answer

Shaun McHugh picture Shaun McHugh · Jul 22, 2016

GUID is the acronym for "Globally Unique Identifier". A GUID is mainly used to produce hexadecimal digits with groups separated by hyphens for uniqueness purposes, for example:

b3d27f9b-d21d-327c-164e-7fb6776f87b0

In postman you can use this to generate and send a random GUID to your api as required:

{
    "id": "{{$guid}}",
}

On Send would produce(with the random example above):

{
    "id": "b3d27f9b-d21d-327c-164e-7fb6776f87b0",
}