Skip to content

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

image-202301121218


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

image-202301121220


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

image-202301121220

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

image-202301121340

· Give request URL: http://localhost/WebApplicationSCM/JSONAPI/HealthCheck

Title : HealthCheck

Request type :  GET

Save it and send

image-202301121345

If the Planvisage Web Application API is live and running then we will get the following response

image-202301121348

Step 4: Call API to get access token using registration token

· Click on Add Request like in the image

image-202306151250

· 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

image-202301121350 image-202301121351

· You will get an Access token like below

image-202301121352

· 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

image-202306151250

· 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

image-202301121500 image-202301121501

· 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

image-202306151250

· 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

image-202301121500 image-202301121501

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

image-202301121510

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

image-202301121520

· You will get a successful result as given below

image-202301121520

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