Introduction
In this API doc, we will discuss more details about each API endpoint. dependency
In this section, we will discuss the common steps to call any API from the swagger and call using Postman. We will also discuss how to read the schema of a body in an API call. In each API call, you need to pass auth token in headers. You can get this token by logging into the system by calling the /auth/token API. After getting the auth token you need to remember the token expiry time
Important Note: Your token has 50 minutes expiry time. After that time you need to log in again and need to get a fresh token for your communication with APIs.
Here are the main steps to call an API from swagger.
Authenticate the API user and get auth token.
Step 1. Click the API endpoint (you want to call) like /auth/token
Step 2. Click the try it out button.
Step 3. Enter the parameters and request body.
Step 4. Click Execute button. After clicking this button you see the response of API.
Step 5. Copy access token as red marked a log text when there is success code 200 (mentioned below).
Step 6. Click Authorize button. On click, there will display a popup modal with text input.
Step 7. Enter the copied auth token from step 5 in the text field and click Authorize button. After clicking Authorize button you see the logout and cancel buttons in a popup. Now API is authorized successfully, and you need to click the cancel button and continue API usage in swagger for 50 minutes (as mentioned above auth token expiry time).
Call API from swagger.
After successful authentication, you will be able to try APIs in the swagger. To do that, you need to perform the first 4 steps as explained above for authenticate API (as Authenticate is itself an API, so, these first four steps will be the same).
Call API from the postman.
To call an API from postman you need to perform the first 4 steps as explained above for Authenticate API. After executing the API in swagger in step 4 you will be able to see the cURL command as in below. image.
Step 1. Copy the cURL command from swagger and open the postman (either the online version OR desktop app)
Step 2. Click the import button in the postman application.
Step 3. Click the Raw Text tab and past the copied cURL command (from swagger) here and click the continue button. After that click the import** button.
Step 4. Click Send button. Now, you can see the response of API in postman below.
How to read the schema of an API call.
At bottom of Swagger, there schema available for the entities of API with examples and some description of data. Here is some rule of thumb to read schema:
1. Properties are on the left side.
2. Values are on the right side.
3. The example and description are below the data type on the right side.
4. Fields with a red asterisk are required fields i.e.