How to use dynamic GUID in Postman?

We can use dynamic GUID in Postman. This can be utilized in the request URL, Body or Headers by simply adding the value {{$guid}}. It does not need any declaration or initialization.

Thus {{$guid}} can be used directly in Postman without any requirement of prior processing of the variable. Postman has support for dynamic variables. GUID is one such instance.

We need not allocate memory or value for this variable. The syntax is {{$guid}}. Besides GUID, there are other dynamic variables like randomInt, timestamp, and so on in Postman.

Usage of Dynamic GUID in URL

Url −{{$guid}}

The above image shows the usage of {{$guid}} in the URL. On sending the request, we have obtained a successful Response of 200 OK.

Usage of Dynamic GUID in Request URL

Let us execute a POST request on the endpoint − Add a request Body as given below −

   "customerId": "{{$guid}}"

Send the POST request. Once the Response is obtained, the Response Body shows the customerID field having a dynamic value generated with GUID.

Usage of Dynamic GUID in Request Headers

The dynamic GUID can also be added in request Headers directly in the format {{$guid}}.

Updated on: 25-Jun-2021

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started