Agile Developer

Call third party API

Axpert 11
TStructs (Forms)
IViews
Scripts
Axpert Jobs
Axpert Cards
HTML Plug-ins
Users & Roles
Workflow
Axpert API
Application Var/Params
Publish Axpert Apps
Axpert Mobile
Settings
Utilities
Customization
WebServices
Axfast

Call third party API

Use function ExecuteAPI(APIDefinitionName) in script to make an API call. As part of the API definition the URL, header string, parameter string & request string can be set. These strings are constructed based on the requirement of the third-party API. The data can be read from Axpert database using FireSQL & SQLGet functions. The data can be transformed either using a database procedure. Simple string constructions can be done using Axpert scripts. The result of every API call will be updated into database table name AxAPIJobDetails. This result can be seen in the admin console.

Execute API
To import data using API, create an API definition using the option from the utility section.

Define the request string format, as used in the document that is to be imported. The URL is unique for every user.
Note: The file from which the data is to be imported should be placed in the server path.

Then use the API defined, in the tstruct by writing a script as shown below

preqdata := AxExecuteAPI({GetPurReqData})
firesql({a},{call fn_json_table( :preqdata ) } )
sqlstr := {select * from imptemptable order by pono}
sqlpost(sqlstr,{purex},{pono},{pono},{purexpost})

Create a button to execute the API call.

Click on Submit. Save the structure and go to run site. Find the tstruct and click on the user-defined button in the options section. The data will be imported into the tstruct on the button click.