Api register
API Application Registration
1. Generate Authentication Token
· Go to System Admin --> Authentication Token --> Add one row
· User can choose the expiry date for the token.
· Check this Example
2. Create APIs in API Configuration screen
· 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
3. Call API to get access token using registration token
Use an API tool for 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 access token using registration token
· Click on Add Request like in the image
· Give URL for AccessToken : http://localhost/WebApplicationSCM/JSONAPI/GetAccessToken
Type : POST
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 few minutes.
So whenever you get the result "Access token Expired", come back to 'GetAccessToken' and click on Send again.
Copy the new access token and use it
4. Call API to Import or Export data using the access token
Step 1: Call API to Pull data using access token
· Here, Pull the data using gernerated access token with API defined for type Export.
· Click on Add Request like in the image
· 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 2: Call API to Push data using access token
· Duplicate PullData by clicking on the three dots in PullData or 'Ctrl+D' or click on Add Request like in the image
· Give URL for Push Data : http://localhost/WebApplicationSCM/JSONAPI/PushData
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
The user can also test API for Replace/Clear All operation by configuring the Insert type in API Configuration screen or adding a new row