Sunday, July 5, 2020

POSTMAN:Extraction and parameterization

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:
  1. Select the environment under use
  2. Add a new varaible say "url"
  3. Set current value as url which is paramaterize as shown in the above picture
  4. Now u can use {{url}}/resourcename inplace of full url (which turns orange)
  5. You can hover over orange variable name to verify if is displaying the correct Endpoint.


No comments:

Post a Comment