Introduction
In this guide, you will be shown the basics on how to get authenticated and make requests to the DealTrack API.
Authentication
In order to access the DealTrack API, you need to be authenticated. All requests must be authorised via a JSON Web Token (JWT). To generate this token, send a HTTP POST request to the token endpoint,
https://api.deal-track.com/oauth2/token
, including the following credentials as application/x-www-form-urlencoded
encoded form data:
- ClientId
- ClientSecret
- Scopes
- RegistrationId
To obtain these credentials, please contact Enable. More information can be found on our Authentication page.
If your credentials are correct, the endpoint will return a valid JWT that you can use to authorise all your requests to the DealTrack API.
Read from the API
Now that you have your access token, you can try using it to make a GET request to the API. As an example, we will show how to send a request to get deal information from DealTrack by sending a HTTP GET request to https://api.deal-track.com/v1/deals.
In this request, you must send a request header that provides the JWT you received in the last step. The bearer token should be placed in the request header, with the key authorization and a prefix of “Bearer”:
Key | Value |
---|---|
Content-Type |
application/vnd.api+json |
Authorization |
Bearer eyJhbGciOiJIUzI1... |
curl --request GET "https://api.deal-track.com/v1/deals" --header "Authorization: Bearer eyJhbGciOiJIUzI1...."
If you were successfully authorised, the API should return you a JSON object containing a list of deals that looks something like this:
{
"data": [
{
"attributes": {
"dealType": "01 - Guaranteed Rebate",
"startDate": "2019-01-01T00:00:00Z",
"endDate": "2019-12-31T00:00:00Z",
"reference": "Deal1",
"description": "Deal1 2019",
"notes": "Notes Deal1 - External notes",
"latestTransactionDate": "2019-02-14T00:00:00Z",
"contraEarnings": false,
"modifiedBy": "Test User",
"earningsModified": "2019-02-14T13:00:00.3970008+01:00",
"postPeriod": 0,
"paymentFrequency": 0,
"claimPoint": null,
"quarterlyWithInstalment": false
},
"relationships": {
"scheme": {
"links": {
"self": "/v1/deals/j1mt/relationships/scheme",
"related": "/v1/deals/j1mt/scheme"
}
},
"items": {
"links": {
"self": "/v1/deals/j1mt/relationships/items",
"related": "/v1/deals/j1mt/items"
}
}
},
"type": "deals",
"id": "j1mt"
}
]
}
Related data is provided in the “Relationships” section of the JSON returned. These URLs can be used to obtain related information to the entity returned.
Comments
0 comments
Please sign in to leave a comment.