#[Postman Sandbox] Need help generating unique uuids

5 messages · Page 1 of 1 (latest)

oak viper
#

huh why is it deleted?

#

{
"email":"{{$randomUUID}}@example.com"
}

when I ran 10k iterations 18 calls failed with email already registered. is there anything else I can use instead of random uuids?

willow briar
#

You could use the uuid NPM package in the scripting sandbox or a different package that creates unique guids?

#

Add this to a pre-request script:

const uuid = pm.require('npm:[email protected]');

pm.variables.set("guid",`${uuid.v4()}.example.com`);

Then using it in the request payload:

{
    "email":"{{guid}}@example.com"
}
oak viper
#

thanks