This guide shows you how to get a token and make your first request to the Enable Rebates API.
1. Get a token
Send a POST request to https://api.trading-programs.enable.com/oauth2/token with your client_id, client_secret, dealtrack_registration_id, scope and grant_type as application/x-www-form-urlencoded form data. To get credentials, contact Enable. The Authentication guide has the details and an example.
If your credentials are correct, the response contains an access_token.
2. Read from the API
Use the token to request a list of deals. Put it in the Authorization header with the prefix Bearer:
Header | Value |
|---|---|
|
|
|
|
curl --request GET "https://api.trading-programs.enable.com/v1/deals" \
--header "Authorization: Bearer eyJhbGciOiJIUzI1...."If the request is authorised, the API returns a JSON object containing a list of deals, 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,
"paymentFrequencyLabel": "End of program line",
"processed": true,
"claimPoint": 0,
"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 linked from the relationships section. Use those URLs to get the related records. The Data structure guide explains filtering, sorting and including related data.