2

I need to run another request before running my current one.

The reason I need to do this is because the other request creates a token using an API key. I then set the token in an environment variable to authenticate the method I'm trying to run.

Example

enter image description here

Alex Baban
  • 11,312
  • 4
  • 30
  • 44
sendricardo
  • 31
  • 1
  • 3
  • Hi, Thanks for your contributions. Yes what I wanted to do is point to another request inside of the pre-request section. I guess if it's not possible I'll need to run two requests each time - one to load a newly generated token and then use that token to execute the request. – sendricardo May 26 '19 at 20:27

2 Answers2

0

You can do as DieGraueEminenz suggested, just move the request above your first request because Postman will run requests in the order that they are placed. The other option is to create your "Token Search" request in the pre-request script section of the request that you want. Here's some good examples on how you might achieve that: https://gist.github.com/madebysid/b57985b0649d3407a7aa9de1bd327990

If what you're asking is how to point/reference another request inside of the pre-request section of a request then that is not possible.

so cal cheesehead
  • 2,515
  • 4
  • 29
  • 50
-1

Just move the first request for token generation on top of your collection. You can do this by drag&drop. If you have folders in your collection: Put the first request in a separate folder an move this folder on top of the collection by drg&drop.

DieGraueEminenz
  • 830
  • 2
  • 8
  • 18