How to get the ID from a response body, set it as dynamic variable and use it in next request Body as variable?

Hello all,
I’m trying to find a solution of the following situation:
POST - Create account
POST - Login
POST - Start //Giving me the first question’s id into the respond
POST - Question 1 //Giving me the id of the next question in the response.

What I’d like to do is taking the respond from POST Start Body and set it as variable into my Environment. Then taking this variable’s value and putting it into the Next Question’s Body as variable…and so on.

Best regards,

1 Like

Take a look at this tutorial I did a while back.

Essentially you need to:

  • parse the response, extract the data you need
  • set a Postman variable
  • use that Postman variable in another request.

3 Likes

I think this response has the wrong video with it. The video is about passing data in the request. It did not speak to parsing responses or setting a variable.

This type of activity is covered in the Postman Learning Centre.

If you are new to Postman, then I would suggest a visit to the Learning Centre.

Overview | Postman Learning Center

Including the Postman Training links under “Other Resources”.

image

I would recommend the “Galaxy APIs 101” course first as it gets you used to the application features.

Then the “Galaxy Testing and Automation” course which teaches you how to assert the responses. It includes defining and using variables from responses.