Skip to content

Instantly share code, notes, and snippets.

@JamesMessinger
Created July 27, 2017 19:24
Show Gist options
  • Save JamesMessinger/1e6702e0c96be032d905adb274727baa to your computer and use it in GitHub Desktop.
Save JamesMessinger/1e6702e0c96be032d905adb274727baa to your computer and use it in GitHub Desktop.
setNextRequest() example
var customer = JSON.parse(responseBody);
if (customer.id === undefined) {
// No customer was returned, so don't run the rest of the collection
postman.setNextRequest(null);
}
else {
// Save the customer ID to a Postman environment variable
postman.setEnvironmentVariable("cust_id", customer.id);
// The "Edit Customer" request uses the "cust_id" variable
postman.setNextRequest('Edit Customer');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment