POSTMAN : Extraction and parameterization
Extraction:
- Click on + symbol and Create a new Environment
- Once Environmanr is created , add a varaible example "token" in the environment and keep other fields blank
- Create a request which gives a response
- Click on test tab and add below lines of code (Javascript)
var jsonData = pm.response.json();
pm.environment.set("token", jsonData);
- once you run the request postman should be able to capture the token. You can verify by clicking on the "eye" button .
- to use the token , you need to use {{variable}} Eg : {{token}}
Parametrize url:
- Select the environment under use
- Add a new varaible say "url"
- Set current value as url which is paramaterize as shown in the above picture
- Now u can use {{url}}/resourcename inplace of full url (which turns orange)
- You can hover over orange variable name to verify if is displaying the correct Endpoint.
No comments:
Post a Comment