Created
June 26, 2015 13:11
-
-
Save rajbharath/5f37827031692845cf87 to your computer and use it in GitHub Desktop.
How to create UUID in postman rest client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{$guid}} | |
the above variable will generate UUID in Postman Rest Client | |
Sample request is below | |
======================== | |
{ | |
"user":{ | |
"id":"{{$guid}}" | |
} | |
} |
By now (2018-06-01) you can simply do the following: var uuid = require('uuid'); var myUUID = uuid.v4();
.
you can also use their dynamic variables: https://learning.getpostman.com/docs/variables_list/
Does anyone know which version of UUID this {{randomUUID}} generates ?
Much thanks @rajbharath! 👍
you can also use their dynamic variables: https://learning.getpostman.com/docs/variables_list/
This is now located here: https://learning.getpostman.com/docs/postman/variables-and-environments/variables-list/
Does anyone know which version of UUID this {{randomUUID}} generates ?
v4
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Found this on Stack Overflow and tested in most recent update on Linux.
In your Pre-request Script, add this to any test you need a fresh v4 UUID in:
postman.setGlobalVariable("v4uuid", 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8); return v.toString(16); }));
Then call this in your post body, headers, wherever it's needed:
{{v4uuid}}