Collection with 2 requests (A and B), how to call A from B?

I have a collection with 2 requests (A and B), how can I call A from B?

Request A gets a token and set the token to a collection variable.
Request B makes a GET request against an API using the token collection variable set by request A.

I usually run A first, then run B.
I tried the “Run collection” option, but I cannot see the API response when request B is run.

Other posts indicate to use Pre-request Script with complete JS scripts, but I just want to run an existing request on the collection.

Hi @neualex,

Correct me if I am wrong. Do you want to use the token which you fetched in request A and use it in request B?

If so, then in the test script of request A, you can set the value of the token to a collection variable. And in request B use the variable in the request or in place of token value.

Hope this helps :slight_smile:

Hi @pranavdavar,

Already doing what you suggest which is a 2-step process, here is what I’m trying to accomplish…

Under my Trustpilot collection, the “Get OAuth Token” request sets an environment variable for the received token, “AuthorizationToken”.


Then, I run “Get Reviews” request which uses this “AuthorizationToken” variable to properly execute this request.


I always run “Get OAuth Token” request first, then “Get Reviews” request second.

Is it possible to call “Get OAuth Token” request from “Get Reviews” request using the “Pre-req” tab?

If yes, how?