Authorisation v2 - Endurancezone-com/API-docs GitHub Wiki
Authorization
In order to use the EZ Loyalty API your application will need a valid API key to create a Bearer Token, which can then be used for all Api Calls. For security reasons different keys are required for different environments.
The API key should be used in calls to GetAuthToken ([GET] /v2/GetAuthToken) by providing it in the ApiKey header. All other endpoints require the Bearer token in the Authorization header.
Endpoints will return a 401 status code if the API Key (for GetAuthToken) or Bearer token (for all other calls) provided is missing, invalid or expired.
NOTE: Bearer tokens have a life span of 5 minutes before they expire and a new one needs generating.
See below for an example of an API key being used
Curl
curl --location 'https://api.test.myezrewards.com/v2/GetAuthToken' \
--header 'apikey: ••••••' \
--data ''
HTTP
GET /v2/GetAuthToken HTTP/1.1
Host: api.test.myezrewards.com
apikey: ••••••
The response that is returned from the GetAuthToken Api, will be as follows:-
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJQYXJ0bmVySWQiOiI5NDAyOTMiLCJQYXJ0bmVyTmFtZSI6IlZpcmdpbiBBY3RpdmUiLCJleHAiOjE3MTY5NzcxNTYsImlzcyI6IlRlc3QuY29tIiwiYXVkIjoiVGVzdC5jb20ifQ.NIkNmBnIJzPq--hTCfSXosg9yz9vVoDw4FKBNNiKXvY"
}
Use this token in proceeding Api calls such as
Curl (Bearer)
curl --location 'https://api.test.myezrewards.com/v2/members?emailAddress={{emailAddress}}' \
--header 'Authorization: Bearer {{token}}' \
--data ''
HTTP (Bearer)
GET /v2/members?EmailAddress={{emailAddress}} HTTP/1.1
Host: api.test.myezrewards.com
Authorization: Bearer {{token}}