TraX offers a web API designed on REST principles:
- TraX API reference - OpenAPI document detailing operations, server URLs, etc.
- TraX API release log - Chronologically ordered list of notable changes for each release of API.
Autentication & Authorization
Authentication and authorization are handled using the OAuth Resource Owner Password Credentials Grant flow part of the OAuth 2.0 Authorization Framework RFC.
Credentials needed for API access will be provided during the initial stages of the onboarding process.
Request an Access Token
// Retrieve an access token
content-type: application/x-www-form-urlencoded
POST https://am.gravitee.skf.com:8092/skf-prod/oauth/token/oauth/token
grant_type=password&
client_id=<Client id>&
client_secret=<Client secret>&
username=<Client username>&
password=<Client password>
When the request is successful, the response payload will appear as follows:
// Access token response example
{ "access_token": "", "token_type": "bearer", "expires_in": 3599 }
The access_token
attribute holds the access token, and the expires_in
attribute shows how long the access token is valid. When the access token has expired, a new one must be requested.
RECOMMENDED: Make the TraX API client code request a new access token at activation, and use the
expires_in
attribute divided by two (2) to schedule the request of a new access token to ensure a valid access token is always available.
Using the Access Token
The Authorization
header must be included in API requests.
// API request example that shows how to use the access token
Authorization: Bearer <your access token>
GET /trax/fleets
The operation /GET /trax/fleets
can be used to test the API. Expect the response to be empty, unless you have onboarded a fleet using the TraX web APi.
Comments
0 comments
Article is closed for comments.