Document toolboxDocument toolbox

How to use API PostMan

Creating a collection


  • As shown in the below screenshot, we need to add the link and click on continue.


  • After that it will ask to confirm the import as below shown.


  • After importing the collection, it will appear in the left side of the postman.


  • All the details which is their in ASTPP system will be define from this collection


Creating an Environment


  • On the right side there is "No Environment " option and one symbol also, we need to click on eye symbol as shown in below screenshot in order to create the environment .



  • Click on the Add Environment

  • After that as shown below, here you need to add  Variable, Initial vale and current value.



  • Variable and initial values are same for all the system, we need to add common variable and initial value like below:

  • You need to add auth token as:- 

             x_auth_token - nOcBurg5KvyurOri8A9ds3rXWafZ99Du


  • Then after add the URL of your portal:-   

              api_url - https://3.109.3.164/


  • Token will generate after we login the admin account of the given URL


How to login in portal through API

  • You need to add this path:   {{api_url}}/api/login/    in the post section as shown in below screenshot, then click on body field from the below mentioned fields.
  • There you can see the JSON format code , you need to add username and password .
  • Then click on the SEND which is there in Blue colour.


  


  • After clicking on SEND button, you will see if the code run successfully or not.
  • If it will run successfully it will generate on the right side as true, as shown in the below screenshot.


  • After successfully login in to the admin portal, there is one token on the right side of the postman where we got status:"true", we can find the token for it in the last few lines of our response, as shown below.


  • We can add this token in our environment which we create above in  third section of token.
  • If the code will not run successfully it will generate false error on the place of true, it means that login is unsuccessful.

Three reasons for unsuccessful login

  • First of all if we do not have installed API addon in portal then it will run the below error.

  • If the addon is installed then we need to check the Auth token, if that is added wrongly then it will run the below error.


  • Then we need to check the URL , if that is added wrongly then it will run the below error.