Tom Tom
Tom Tom

Reputation: 23

Postman headers request how save and use in next request

I create in postman request - {"name": "Tom"}. The user is created. In the Body section I have this record: { "id": "32esd", "name": "Tom" } I would like to get a body to ID and use it in another query. Where he tests the editing option.

How can I do this in postman? Thank you for your help.

Upvotes: 0

Views: 903

Answers (1)

shaochuancs
shaochuancs

Reputation: 16226

You can use Postman to chain several HTTP requests together, with variables (such as "global variable" or "environment variable") to save result of one request, and use it in the next one.

First, in the request that create the user and receive id, set variable in its "Tests" panel (take global variable for example):

enter image description here

Then, you can use this global variable in subsequent requests. In URL of GET request for example:

enter image description here

Or, in the body of another POST request:

enter image description here

There are several types of variable and many related features in Postman, you can check the document and pick the most appropriate one.

Upvotes: 3

Related Questions