How to use Post's response to create GET call?

I am trying to make a flow of REST API calls in Postman, but without success.

  1. I have a Post call that returns Json. I want to take the response and use it in GET call. Is it possible to do this by pre-request script or otherwise?

  2. Is it possible to loop the GET call several times until I get a particular response?

Hi @henva, Warm welcome to the Community :bouquet:

Question 1, is very commonly answered among the community queries.

You just need to save the response in an variable based on your scope:

pm.environment.set("Post_Response", (responseBody));

Now the entire response of your POST request will be stored in the environment variable “Post_Response”.

You just need to use this variable in the body of your next GET request.


And for Question 2, kindly refer the below documentation.

Based on your conditions you need to write scripts to handle it.

Please try to provide more details incase if you still have any issues :slightly_smiling_face:

1 Like