getChallenges to implement different challenge listings:
- completed by the current API user;
- ongoing (the current date is between start and end dates, AND the challenge is not completed by the current API user yet);
- upcoming (the start date is in the future);
- all available challenges (except those ones that are finished and not completed by the current API user).
Challenge objects
that fit the applied filters.
Results will be returned with the pagination and possibility to change the order and sorting key (default sorting is by the start date, ascending).
The following arguments can be used in the query:
| Argument | Type | Description | Default |
|---|---|---|---|
after | Cursor | Returns results that come after the specified cursor. Should be used together with first parameter. Cannot be used if before is set. | — |
before | Cursor | Returns results that come before the specified cursor. Should be used together with last parameter. Cannot be used if after is set. | — |
first | Int | Returns up to the first N elements from the list. Required if after parameter is set. Cannot be used together with last. | — |
last | Int | Returns up to the first N elements from the list. Required if before parameter is set. Cannot be used together with first. | — |
reverse | Boolean | Allows to reverse the order of the underlying list (default order is ascending). | false |
sortKey | ChallengeSortKey | Allows to change the results sorting. Available options: START_DATE (default), END_DATE | START_DATE |
status | ChallengeStatus | Provides the possibility to filter by the challenge status. Available options: COMPLETED, ONGOING, UPCOMING. Leave empty to get all available challenges; missed ones will be excluded from the results. | — |
userContextId | ID | The user context ID to get the list of challenges for. If omitted, the results will be retrieved for the current API user context. | — |
Related Features
ThegetChallenges query supports the same advanced features as other catalog queries: