Field-Level Query Guide
Complete guide for querying specific fields in each API endpoint.
📚 Documentation Navigation
- ← Back to Main README - Overview and features
- ← Quick Start Guide - Setup instructions
- ← API Documentation - Testing tools and Swagger
- Testing Examples → - Practical code examples
Partners API - /odata/Partners
The authenticated partner can only access their own partner record. This endpoint always returns one record.
Available Fields
Id(long) - Partner IDName(string) - Partner nameDescription(string) - Partner description (mapped fromFooterCopyright)LogoUrl(string) - Logo URLWebsiteUrl(string) - Partner website / rewards URLIsActive(bool) - True when Status is'Active'CategoryId(long) - Category ID (may be null)
Navigation Properties (use $expand)
RewardRewards- Rewards belonging to this partner (available via single-record endpoint)
Query Examples
Get Authenticated Partner
GET /odata/Partners
Get Partner by ID
GET /odata/Partners(123)
Select Specific Fields
GET /odata/Partners?$select=Id,Name,WebsiteUrl,IsActive
Rewards API - /odata/Rewards
Available Fields
Identity & Basic Info
Id(long) - Reward IDTitle(string) - Reward titleName(string) - Reward name (same as Title)SubTitleText(string) - Subtitle textDescription(string) - Offer description (same as OfferDescription)OfferDescription(string) - Offer descriptionBrandName(string) - Brand nameBrandId(long) - Associated brand IDPartnerId(long) - Associated partner IDStatus(string) - Status string (e.g.,'Active')IsActive(bool) - True when Status is'Active'
Discount Information
DiscountAmt(double) - Discount amountDiscountCode(string) - Discount codeDiscountString(string) - Discount description
URLs & Links
BrowseUrl(string) - Browse URLRewardUrl(string) - Reward claim URLRewardUrlInstruction(string) - Instructions for reward URLMoreInfoUrl(string) - More information URL
Status & Features
IsFeatured(bool) - Is featuredIsHotOffer(bool) - Is hot offerPartnerHighlighted(bool) - Is highlighted by partnerUseOneTimeRewardCodes(bool) - Uses one-time codesUseOneTimeQrRewardCodes(bool) - Uses one-time QR codesViewCount(int) - Number of viewsSortOrder(int) - Display sort order
Availability
LocationAll(bool) - Available in all locationsLocationsList(string) - Comma-separated location listMemberLevelList(string) - Comma-separated member level listMinAvailLevel(string) - Minimum availability levelValidFrom(DateTime) - Start dateValidUntil(DateTime) - End dateDateAdded(DateTime) - Date reward was addedCreatedAt(DateTime) - Same as DateAdded
Content
HowToClaim(string) - Claim instructionsRewardTerms(string) - Terms and conditions
Navigation Properties (use $expand)
RewardRewardOrgUnit- Organisation units associated with the rewardRewardMemberlevels- Member levels eligible for the rewardRewardLocations- Locations where the reward is availableRewardRewardDiscountCountrys- Countries where discount is validRewardBrand- Brand detailsRewardPartner- Partner details
Query Examples
Search by Title
GET /odata/Rewards?$filter=contains(Title,'Discount')
Get Active Rewards Only
GET /odata/Rewards?$filter=IsActive eq true
Get Featured Rewards
GET /odata/Rewards?$filter=IsFeatured eq true&$orderby=Title
Get Hot Offers
GET /odata/Rewards?$filter=IsHotOffer eq true
Filter by Partner
GET /odata/Rewards?$filter=PartnerId eq 123
Get Rewards with Discount Code
GET /odata/Rewards?$filter=DiscountCode ne null
Get Rewards by Discount Amount Range
GET /odata/Rewards?$filter=DiscountAmt ge 10 and DiscountAmt le 50
Select Specific Fields
GET /odata/Rewards?$select=Id,Title,DiscountString,IsActive,IsFeatured
Expand Brand and Partner
GET /odata/Rewards?$expand=RewardBrand,RewardPartner
Expand Member Levels and Locations
GET /odata/Rewards?$expand=RewardMemberlevels,RewardLocations
Complex Query - Active Featured Rewards
GET /odata/Rewards?$filter=IsActive eq true and IsFeatured eq true&$orderby=Title&$select=Id,Title,DiscountString
Get Rewards Valid in a Date Range
GET /odata/Rewards?$filter=ValidFrom le 2024-12-31T00:00:00Z and ValidUntil ge 2024-01-01T00:00:00Z
Tracking Activities API - /odata/TrackingActivities
Backed by Elasticsearch. All data is automatically scoped to the authenticated partner. Deep pagination (beyond 10,000 records) uses
search_aftertokens automatically via@odata.nextLink.
Available Fields
Id(long) - Activity IDCreatedAt(DateTime) - Activity timestampType(string) - Activity type (e.g.,'click','view','impression')UserId(long) - User IDRewardId(long) - Reward ID
Navigation Properties (use $expand)
User- User who performed the activity (from Elasticsearch)Reward- Reward associated with the activity
Supported $filter Fields
The Elasticsearch backend supports filtering on: CreatedAt (gt/ge/lt/le), UserId (eq), RewardId (eq), Type (eq)
Supported $orderby Fields
CreatedAt (default, descending), UserId, RewardId, Type
Query Examples
Get Activities by Type
GET /odata/TrackingActivities?$filter=Type eq 'click'
Get Activities for Specific User
GET /odata/TrackingActivities?$filter=UserId eq 456
Get Activities for Specific Reward
GET /odata/TrackingActivities?$filter=RewardId eq 789
Get Activities by Date Range
GET /odata/TrackingActivities?$filter=CreatedAt ge 2024-01-01T00:00:00Z and CreatedAt le 2024-01-31T23:59:59Z
Get Recent Activities (Last 24 Hours)
GET /odata/TrackingActivities?$filter=CreatedAt ge 2024-11-04T00:00:00Z&$orderby=CreatedAt desc
Expand User and Reward Data
GET /odata/TrackingActivities?$expand=User,Reward&$top=100
Complex Query - User Activity for a Specific Reward Type
GET /odata/TrackingActivities?$filter=UserId eq 456 and Type eq 'click'&$orderby=CreatedAt desc&$top=100
Get Multiple Activity Types
GET /odata/TrackingActivities?$filter=Type eq 'click' or Type eq 'view'
Tracking Logins API - /odata/TrackingLogins
Backed by Elasticsearch. All data is automatically scoped to the authenticated partner. Deep pagination (beyond 10,000 records) uses
search_aftertokens automatically via@odata.nextLink.
Available Fields
Id(long) - Login IDLoginTime(DateTime) - Login timestampUserId(long) - User IDCachedAt(DateTime) - Timestamp when this record was fetched
Navigation Properties (use $expand)
User- User who logged in (from Elasticsearch)
Supported $filter Fields
The Elasticsearch backend supports filtering on: LoginTime (gt/ge/lt/le), UserId (eq)
Supported $orderby Fields
LoginTime (default, descending), UserId
Query Examples
Get Logins for Specific User
GET /odata/TrackingLogins?$filter=UserId eq 456
Get Logins by Date Range
GET /odata/TrackingLogins?$filter=LoginTime ge 2024-01-01T00:00:00Z and LoginTime le 2024-01-31T23:59:59Z
Get Recent Logins (Last 7 Days)
GET /odata/TrackingLogins?$filter=LoginTime ge 2024-10-29T00:00:00Z&$orderby=LoginTime desc
Expand User Data
GET /odata/TrackingLogins?$filter=UserId eq 456&$expand=User
Get Latest Login for a User
GET /odata/TrackingLogins?$filter=UserId eq 456&$orderby=LoginTime desc&$top=1
Tracking Impressions API - /odata/TrackingImpressions
Backed by the database. Data is cached for 30 minutes — check the
CachedAtfield for cache age. All records are automatically scoped to the authenticated partner. Standard$skip/$toppagination applies.
Available Fields
Id(int) - Impression IDUserId(string) - User ID (stored as string)RewardId(long) - Reward IDCreatedAt(DateTime) - Impression timestampCachedAt(DateTime) - Timestamp when this record was cached
Navigation Properties (use $expand)
User- User who viewed the rewardReward- Reward that was viewedUser($expand=AccountsUsersOrgUnits)- Include user's organisation units
Query Examples
Get Impressions for Reward
GET /odata/TrackingImpressions?$filter=RewardId eq 789
Get Impressions with User and Reward Details
GET /odata/TrackingImpressions?$expand=User,Reward&$select=Id,CreatedAt
Get Impressions with User and Org Units
GET /odata/TrackingImpressions?$expand=User($expand=AccountsUsersOrgUnits)
Date Range Query
GET /odata/TrackingImpressions?$filter=CreatedAt ge 2024-01-01T00:00:00Z&$orderby=CreatedAt desc
Users API - /odata/Users
Backed by the database. All records are automatically scoped to the authenticated partner. OData
$filter,$orderby,$select,$top, and$skipare all supported.
Available Fields
Identity
Id(long) - User IDEmail(string) - Email address
Personal Info
FirstName(string) - First nameLastName(string) - Last name
Account Status
IsActive(bool) - Is activeStatus(string) - Account status string (e.g.,'active')DateJoined(DateTime) - Date the member joinedRenewalDate(DateTime) - Renewal dateDateRenewed(DateTime) - Date last renewedDateCancelled(DateTime) - Date cancelled (if applicable)MemberLevel(string) - Member tier or level
Relationships
PartnerId(long) - Partner ID (automatically scoped)CountryName(string) - Country name
Navigation Properties (use $expand)
AccountsUsersOrgUnits- Organisation units the user belongs toAccountsUsersOrgUnits($expand=OrgUnit)- Include org unit details
Cache Metadata
CachedAt(DateTime) - Time data was cached
Query Examples
Search by Email
GET /odata/Users?$filter=Email eq 'user@example.com'
Get Active Users Only
GET /odata/Users?$filter=IsActive eq true
Get Recently Joined Users
GET /odata/Users?$filter=DateJoined ge 2024-01-01T00:00:00Z&$orderby=DateJoined desc
Search by Name
GET /odata/Users?$filter=contains(FirstName,'John') or contains(LastName,'Smith')
Filter by Member Level
GET /odata/Users?$filter=MemberLevel eq 'Gold'
Filter by Status
GET /odata/Users?$filter=Status eq 'active'
Select Specific Fields
GET /odata/Users?$select=Id,Email,FirstName,LastName,IsActive,DateJoined
Expand Org Units
GET /odata/Users?$expand=AccountsUsersOrgUnits
Expand Org Units with Details
GET /odata/Users?$expand=AccountsUsersOrgUnits($expand=OrgUnit)
Users Elastic API - /odata/UsersElastic
Backed by Elasticsearch. Returns users who have logged in at least once. Deep pagination uses a
searchAfterquery parameter (a numeric user ID) when$skip >= 10000.
Available Fields
Fields returned are from the Elasticsearch user-login index and may vary. Common fields include:
Id(long) - User IDEmail(string) - Email addressFirstName(string) - First nameLastName(string) - Last nameDateJoined(DateTime) - Date joined
Supported $filter Fields
DateJoined(le) - Filter users who joined on or before this date
Query Examples
Get All Users with Login Data
GET /odata/UsersElastic
Filter by Join Date
GET /odata/UsersElastic?$filter=DateJoined le 2024-01-01T00:00:00Z
Paginated with Custom Page Size
GET /odata/UsersElastic?$top=10000&$skip=0
User Analytics REST Endpoints
User Counts - GET /api/users/counts
Returns aggregated counts for churn metrics.
Query Parameters:
joinedBefore(DateTime, optional) - Only include users who joined on or before this datejoinedAfter(DateTime, optional) - Only include users who joined on or after this date
Response Fields:
TotalUsers(int) - Total number of usersActiveUsers(int) - Users who are active, not cancelled, and not expiredChurnedUsers(int) - Total minus activeRenewedUsers(int) - Users who have aDateRenewedvalueCancelledUsers(int) - Users who have aDateCancelledvalueExpiredUsers(int) - Users with expired renewal who have not renewedAtRiskUsers(int) - Always 0; calculated separately based on login activity
Examples:
GET /api/users/counts
GET /api/users/counts?joinedAfter=2024-01-01&joinedBefore=2024-12-31
User Cohorts - GET /api/users/cohorts
Returns cohort retention data grouped by the month users joined (last 24 months).
Response Fields (per cohort):
CohortMonth(string) - Month inYYYY-MMformatInitialUsers(int) - Number of users who joined in this monthRemainingUsers(int) - Currently active users from this cohortChurnedUsers(int) - InitialUsers minus RemainingUsersRetentionRate(double) - Fraction of original cohort still active (0–1)ChurnRate(double) - Fraction of original cohort who churned (0–1)
Example:
GET /api/users/cohorts
User Segments - GET /api/users/segments
Returns churn rates segmented by country and member level (top 5 of each).
Response Fields (per segment):
Segment(string) - Segment name (country name or member level)Category(string) -'Country'or'MemberLevel'TotalUsers(int) - Total users in this segmentHighRiskCount(int) - Users whose renewal is expiring within 30 daysChurnRate(double) - Fraction of segment that is churned (0–1)
Example:
GET /api/users/segments
Reward Countries API - /odata/RewardCountries
Available Fields
Id(long) - Country IDName(string) - Country nameCode(string) - Country codeCreatedAt(DateTime) - Creation timestampUpdatedAt(DateTime) - Last updated timestamp
Query Examples
Get Country by Code
GET /odata/RewardCountries?$filter=Code eq 'UK'
Search by Name
GET /odata/RewardCountries?$filter=contains(Name,'United')
Order by Name
GET /odata/RewardCountries?$orderby=Name asc
Reward Brands API - /odata/RewardBrands
Brands are filtered by the authenticated partner. Data is cached for 30 minutes.
Available Fields
Id(long) - Brand IDName(string) - Brand nameContactName(string) - Contact person nameLogoUrl(string) - Logo URLContactEmail(string) - Contact email addressStatus(string) - Status (e.g.,'Active')
Query Examples
Search by Brand Name
GET /odata/RewardBrands?$filter=contains(Name,'Nike')
Get Brand by Status
GET /odata/RewardBrands?$filter=Status eq 'Active'
Select Key Fields
GET /odata/RewardBrands?$select=Id,Name,ContactName,LogoUrl,ContactEmail,Status
Order by Name
GET /odata/RewardBrands?$orderby=Name asc
Partner Categories API - /odata/PartnerCategories
Categories are filtered by the authenticated partner. Data is cached for 30 minutes.
Available Fields
Id(long) - Category IDName(string) - Category nameDescription(string) - Category description (same value as Name)CategoryAlias(string) - Category aliasCategoryImageUrl(string) - Category image URLShowCategory(bool) - Whether category is visibleSortOrder(int) - Display sort order
Query Examples
Search by Name
GET /odata/PartnerCategories?$filter=contains(Name,'Fitness')
Get Visible Categories Only
GET /odata/PartnerCategories?$filter=ShowCategory eq true
Select Key Fields
GET /odata/PartnerCategories?$select=Id,Name,Description,CategoryAlias,CategoryImageUrl,ShowCategory,SortOrder
Order by Sort Order
GET /odata/PartnerCategories?$orderby=SortOrder asc
Common Query Patterns
Pagination
# Get first 20 items
GET /odata/Partners?$top=20
# Get items 21-40
GET /odata/Partners?$top=20&$skip=20
Sorting
# Ascending
GET /odata/Rewards?$orderby=Title asc
# Descending
GET /odata/TrackingActivities?$orderby=CreatedAt desc
# Multiple fields
GET /odata/Users?$orderby=LastName asc,FirstName asc
Field Selection
# Select specific fields
GET /odata/Partners?$select=Id,Name,WebsiteUrl
# Select with filter
GET /odata/Rewards?$filter=IsActive eq true&$select=Id,Title,DiscountString
Counting
# Get total count
GET /odata/TrackingActivities/$count
# Get count with filter
GET /odata/Users/$count?$filter=IsActive eq true
String Functions
# Contains (case-sensitive)
GET /odata/Partners?$filter=contains(Name,'Gym')
# Contains (case-insensitive)
GET /odata/Partners?$filter=contains(tolower(Name),'gym')
# Starts with
GET /odata/Rewards?$filter=startswith(Title,'Gold')
# Ends with
GET /odata/Users?$filter=endswith(Email,'@example.com')
Date Queries
# Greater than
GET /odata/TrackingActivities?$filter=CreatedAt gt 2024-01-01T00:00:00Z
# Date range
GET /odata/TrackingLogins?$filter=LoginTime ge 2024-01-01T00:00:00Z and LoginTime le 2024-01-31T23:59:59Z
# Today's data (example)
GET /odata/TrackingActivities?$filter=CreatedAt ge 2024-11-05T00:00:00Z
Null Checks
# Is null
GET /odata/Rewards?$filter=DiscountCode eq null
# Is not null
GET /odata/Rewards?$filter=DiscountCode ne null
Combining Filters
# AND
GET /odata/Rewards?$filter=IsActive eq true and IsFeatured eq true
# OR
GET /odata/TrackingActivities?$filter=Type eq 'click' or Type eq 'view'
# Complex
GET /odata/Users?$filter=(IsActive eq true and IsStaff eq false) or IsSuperuser eq true
Tips for Effective Querying
- Always use $select when you don't need all fields - it improves performance
- Use $top to limit results and prevent large data transfers
- Add $orderby for consistent pagination
- Use $count to get totals without retrieving all data
- Combine filters to narrow down results efficiently
- Use tolower() for case-insensitive string searches
- Test queries in Swagger before implementing in code
- Check $metadata endpoint for exact field names and types
Getting Field Information
View All Available Fields
Navigate to the OData metadata endpoint:
GET https://reporting.api.myezrewards.com/odata/$metadata
This returns the complete schema with all entity types and their properties.
Use Swagger UI
- Navigate to
https://reporting.api.myezrewards.com/swagger - Expand any endpoint
- View the schema section for available fields
- Try queries interactively
📚 Related Documentation
- ← Back to Main README - Overview and features
- ← Quick Start Guide - Setup instructions
- ← API Documentation - Testing tools
- Testing Examples → - PowerShell, curl, and C# code samples