REST-Testing with Postman and using response data for next request

Currently, I'm using Postman to run Request against an OData endpoint.

For calling some request, some HTTP-Headers must be present from the authentication.
Till now, I used the stored request variables in the form {{variable}}.

The new values are manually stored in the Environment, which is selected to execute the requests.


and in the stored request, just references to the variables are made:



But this is a manual task, so automation would be the next step.

After asking Google for help, I found this link: http://blog.getpostman.com/2014/01/27/extracting-data-from-responses-and-chaining-requests/

Adding Tests in the request part (upper part in postman) to the first request let's see in a quick overview if everything went well.
It allows setting environment and global variable, which can be referenced as before in the upcoming request.


After executing the request, you can see the result of the 'tests' in the response part (lower part in postman):


After the execution, the variables are set with postman.setGlobalVariable and all further request
using this variable can be executed without any manual intervention.
If you have the variables set somewhere else, they might be overwritten, so be careful and delete them from the environment.