Authentication Variables
In order to authenticate with the ASAP API, the code needs to write the authentication data in the “Authorization” header.
Note: Every request is going to work with the same idea. Create an HttpRequest object with the URL; create the authorization or access token in the header; changes the Accept or Content Type property; wait for the response.
The authentication needs the username, the password and the organization id, joined in a key/value pair format with an equals character (=), and joined all together with an ampersand (&).
Example: user=username&password=password&organizationId=organizationId.
Note: the username and password is unique to your integration application, and is not related to your regular ASAP application credentials.
The access token is in the headers of the response. Every time you need to make a call to the API, you need to send this access token to get authorized. The access token has a 2 hour life, and then gets rejected so you need to send the authorization variables again.
Access Token
Once you get the access token, you need to send it every time you make a request in the headers.
Get List of Entities: Specifications
In order to get a list of entities in the API, you have to make a request with an URL, and the URL need to have the name of entity in plural. The filter parameters come next after the name of the entity. The filters are totally optional and they can be in the query string also.
%Base/{controller name in plurar}/{[filter parameter/ filter parameter/filter parameter]}
The steps are a little bit different from the log in. You need to create the request with the URL, set the access token header, get the response, get the response stream and then format the results in a string, file or object.
Note: The extension code models are classes made just for example. You can make your own models in your app to serialize and deserialze objects.