Quick Start Guide - Reporting API
Authentication Flow (Following ezApi v2 Pattern)
1. Get your API Key from EZ Loyalty Operations → 2. Exchange for JWT Token → 3. Use JWT Token for OData requests
Step-by-Step Example
1. Get Your Partner's API Key
Each partner is issued a unique API key. If you don't already have one, contact the EZ Loyalty Operations team to request it.
2. Generate JWT Token
PowerShell:
$apiKey = "YOUR_API_KEY"
$headers = @{ "apikey" = $apiKey }
$auth = Invoke-RestMethod -Uri "https://reporting.api.myezrewards.com/api/authentication/getauthtoken" -Headers $headers
$token = $auth.token
curl:
curl -H "apikey: YOUR_API_KEY" https://reporting.api.myezrewards.com/api/authentication/getauthtoken
Postman:
- URL:
https://reporting.api.myezrewards.com/api/authentication/getauthtoken - Method: GET
- Headers:
apikey: YOUR_API_KEY
3. Use JWT Token for OData Requests
PowerShell:
$headers = @{ "Authorization" = "Bearer $token" }
Invoke-RestMethod -Uri "https://reporting.api.myezrewards.com/odata/Users?`$top=5" -Headers $headers
curl:
curl -H "Authorization: Bearer YOUR_JWT_TOKEN" https://reporting.api.myezrewards.com/odata/Users
Postman:
- URL:
https://reporting.api.myezrewards.com/odata/Users - Method: GET
- Authorization: Bearer Token
- Token: YOUR_JWT_TOKEN
Complete PowerShell Example
# Step 1: Set API Key
$apiKey = "YOUR_API_KEY"
# Step 2: Get JWT Token
$apiKeyHeaders = @{ "apikey" = $apiKey }
$auth = Invoke-RestMethod -Uri "https://reporting.api.myezrewards.com/api/authentication/getauthtoken" -Headers $apiKeyHeaders
Write-Host "Partner: $($auth.partnerName)"
Write-Host "Token expires in: $($auth.expiresIn)"
# Step 3: Use JWT Token
$bearerHeaders = @{ "Authorization" = "Bearer $($auth.token)" }
# Query OData endpoints
$users = Invoke-RestMethod -Uri "https://reporting.api.myezrewards.com/odata/Users?`$top=5" -Headers $bearerHeaders
$users.value | Format-Table
$partners = Invoke-RestMethod -Uri "https://reporting.api.myezrewards.com/odata/Partners" -Headers $bearerHeaders
$partners.value | Format-Table
$rewards = Invoke-RestMethod -Uri "https://reporting.api.myezrewards.com/odata/Rewards?`$filter=IsActive eq true" -Headers $bearerHeaders
$rewards.value | Format-Table
Key Differences from Previous Version
- ✅ Now: Requires API key in
apikeyheader (follows ezApi v2 pattern) - ❌ Before: Used partnerId query parameter (less secure)
Authentication Schemes
- ApiAuthentication - Uses
apikeyheader, validated against your partner's issued API key - Bearer - Uses JWT token in
Authorization: Bearer {token}header
Endpoints
| Endpoint | Auth Required | Description |
|---|---|---|
GET /api/authentication/getauthtoken |
API Key | Generate JWT token |
GET /api/authentication/partners |
API Key | List partners (testing) |
GET /odata/* |
Bearer Token | All OData endpoints |
Token Lifetime
- JWT Token: 24 hours
- API Key: Permanent (issued by EZ Loyalty Operations)
Troubleshooting
"Provide API key in header 'APIKEY'"
- Add
apikeyheader with your partner's API key
"Invalid API key provided"
- Check for typos in the API key
- Contact EZ Loyalty Operations to confirm your API key is active
401 Unauthorized on OData endpoints
- Ensure you're using
Authorization: Bearer {token}header - Check token hasn't expired (24 hours)
- Verify token was generated successfully