Postman Testing – Chaining Requests From one Request to Another

postman logo

The Issue

I’d like to run a full suite of Postman tests are part of a CD pipeline into pre-production to indicate any issues and stopping the deployment of the API further. I’d built up 200+ Postman tests to cover standard CRUD operations on a number of resources. The tests were checking the POST responses for certain eleements returned in the body, 200 responses etc. Similar for PUTS, PATCHES and GETS. However, it would be nice to create a resource then reference this resource across all API operations for that resource.

The Solution

The easiest way to achieve this is to use tests so that the POST sets an environment based variable based on the Id returned in the response for the newly created resource then pass around in the other operations as needed.

Capture widgetId
Then use the id throughout.

Leave a Reply

%d bloggers like this: