Authentication
Your request to an ATPCO API must authenticate using an active OAuth Access Token provided by ATPCO. Access tokens typically expire after one hour.
OAuth Access Token
The below information explains how to get an OAuth Access Token by way of example using Spring Framework’s RestTemplate class.
Prerequisites
Any API consumer seeking an OAuth Access Token must already have the following:
client_id
– an ID assigned to you by ATPCO (e.g., ABC3DEF)client_secret
– a key (secret string of characters) provided by ATPCO when you were authorized to access ATPCO APIs
If you are missing your
client_id
orclient_secret
, please contact ATPCO Support.
Get an OAuth Access Token
The following example uses Spring Framework’s RestTemplate class to request an OAuth Access Token from ATPCO:
If the above request succeeds (i.e., the OAuth Token Request URL, client_id
, and client_secret
are all correct), the response will include a JSON object like the one below:
The value of the “access_token” key is your OAuth Access Token.
Authenticate Your ATPCO API Call
The below information explains how to use an OAuth Access Token to authenticate an API call, by way of example using Spring Framework’s RestTemplate class.
Prerequisite
Any API Consumer looking to call an ATPCO API must already have an OAuth Access Token. This is a string provided by ATPCO that temporarily grants you access to ATPCO APIs.
If your OAuth Access Token has expired, you must obtain a new OAuth Access Token.
Authenticating
The header of your API request must have a content type of "application/json" or "application/xml" (depending on the API) and must include the following two parameters for authentication:
Parameter | Description | Type | Format |
---|---|---|---|
Authorization* | A valid OAuth access token, issued by ATPCO, prepended with "Bearer" (including the space) | String | “Bearer <OAuth access token>” |
userId* | The ATPCO user ID to authorize data access for this service call | String | “XXX#XXX” |
*required parameter
The below code snippet demonstrates one way to construct a request to ATPCO APIs with an OAuth Access Token. This example uses Spring Framework’s RestTemplate class to request an OAuth Access Token from ATPCO: