By Adam Nagy
Postman is a really nice free tool to test RESTful API's with. You can find it here: https://www.getpostman.com/
Many times you need to use the result of a request as the input parameter of the next request. E.g. I authenticate myself using a 2 legged OAuth call and then I would need to keep using the received access token in further calls.
In Postman you can create Environments and can also add Environment Variables to them which then can be used as the parameters of your queries.
You can reference those variables from inside your queries using double curly braces: {{MyEnvironmentVariable}}
Inside your queries you can also add some scripts to modify these variables: https://www.getpostman.com/docs/writing_tests
This way you can store the result of a query and then reuse that in your next query.
My query is already using some environment variables:
Then I also added a script to store the result:
Now I can use the "AccessToken" variable in my further requests, like bucket creation:
Nice, ey? :)
Comments
You can follow this conversation by subscribing to the comment feed for this post.