API Application Registration
Create Authentication Token
· Go to System Admin --> Authentication Token --> Add one row
· User can choose the expiry date for the token.
Configure API in API Configuration
· Go to System Admin --> API Configuration --> Add rows
· For Import data, Table Name is required and should specify InsertType (Append,Replace,Clear All) also
· For Export data, SQL query is required.
· Check this Example
Use Postman for API test
· We use the API tool Postman to test Planvisage Web Application API
· For using Postman, follow the steps given below
Step 1: Install Postman API platform
· If you already installed Postman, skip this step
· Download Postman supported for your OS by clicking on the link: https://www.postman.com/downloads/
· Install Postman, Create a new free account and open it
Step 2: Create New Workspace and collection
· Create a Workspace (This is optional. If you want to create you should sign up first)
· Create a collection and name it. For Eg: TestAPI (Click on + icon near the Collections )
Step 3: Test Planvisage Web Application API
· Before testing API, check Planvisage Web Application API is live and running
· Click on Add a request
· Give request URL: http://localhost/WebApplicationSCM/JSONAPI/HealthCheck
Title : HealthCheck
Request type : GET
Save it and send
If the Planvisage Web Application API is live and running then we will get the following response
Step 4: Call API to get with access token using registration token
· Click on New --> HTTP Request
· Give URL for AccessToken : http://localhost/WebApplicationSCM/JSONAPI/GetAccessToken
Title : GetAccessToken
In Header part
Key : AuthenticationToken
Value : copy token from Authentication Token in System Admin and paste
Save it in the current collection and Send
· You will get an Access token like below
· Access token will be active for a little time.
So whenever you get the result "Access token Expired", come back to 'GetAccessToken' and click on Send.
Copy the new access token and use it
Step 5: Call API to Pull data using access token
· Give URL for Pull Data : http://localhost/WebApplicationSCM/JSONAPI/PullData
Type : POST
Title : PullData
In Header part
1st Key name : AccessToken
Value : Copy the access token from the previous tab 'GetAccessToken' and paste
2nd Key Name : APIName
Value : Copy API name from table in which type is Export
Save it and Send
· You will get a result in JSON format
Step 6: Call API to Push data using access token
· Duplicate PullData by clicking on the three dots in PullData or 'Ctrl+D'
· Give URL for Push Data : http://localhost/WebApplicationSCM/JSONAPI/PullData
Type : POST
Title : PushData
Change in Header
2nd Key Name : APIName
Value : take name from table in which type is Import
For push data, the data should be in JSON format
Go back to PullData -> Copy one row of data from the result like in the image or copy the entire result
Return to PushData
Click on Body --> Click Row
Paste the code inside the Row; if you selected only one row of data, don't forget to close the brackets
Save it and Send
· You will get a successful result as given below
Hence the API Test is completed
You can also test API for Replace/ClearAll operation by changing the Insert type in API Configuration or adding a new row