Skip to content

Instantly share code, notes, and snippets.

@mattruma
Last active August 4, 2020 13:23
Show Gist options
  • Save mattruma/85b20276cc591e77cccc885fb1398a92 to your computer and use it in GitHub Desktop.
Save mattruma/85b20276cc591e77cccc885fb1398a92 to your computer and use it in GitHub Desktop.
Adventures with Postman: Dynamic Variables
{
"id": "",
"name": "",
"email": ""
}
var name = pm.variables.replaceIn('{{$randomFirstName}} {{$randomLastName}}');
var email = name.replace(' ','');
pm.variables.set('name', name);
pm.variables.set('email', name.replace(' ',''));
{
"id": "{{$guid}}",
"name": "{{name}}",
"email": "GMAIL_USER_NAME+{{email}}@gmail.com"
}
{
"createdOn": "2020-08-04T12:37:44.6674816Z",
"email": "GMAIL_USER_NAME+MalcolmReynolds@gmail.com",
"id": "51fbe6de-c063-4f77-9551-49505c90178d",
"name": "Malcolm Reynolds",
"object": "User",
"updatedOn": "2020-08-04T12:37:44.6674816Z",
"userId": "51fbe6de-c063-4f77-9551-49505c90178d"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment