GET GetChallengesInfoForUser

{baseurl}/api/v1/Integration/GetChallengesInfoForUser?UserId={userId}

Overview

The GetChallengesInfoForUser API endpoint retrieves a paginated list of challenges available to a specific user, with optional filtering by search query, category, and order.

Use Cases Examples:

  1. Retrieve User-Specific Challenges:

    • This API can be used to get a list of all challenges that are available for a specific user.

  2. Filter Challenges by Category:

    • Users can filter challenges by a specific category using the CategoryId parameter.

  3. Search Challenges by Name:

    • Users can search for challenges by their names using the SearchQuery parameter.

  4. Paginate Results:

    • Large sets of challenges can be paginated using the Page and ItemsPerPage parameters.

  5. Sort Challenges:

    • Challenges can be sorted by a specific field, either in ascending or descending order, using the OrderBy and IsAscending parameters.


Request

Header Parameters

AttributeTypeOptionsDescription

X-ClientId

string
Required

Provided Client Id.

X-Message

string
Required

Provided encrypted message.

Accept-language

string
Optional

Selected language for response.

X-ClientId and X-Message are only required with V1 API.

Query Parameters

PropertyTypeOptionsDescription

UserId

string
Required

The phone number of the user for whom challenges are being retrieved.

CategoryId

int
Optional

The ID of the category to filter challenges by.

Page

int
Optional

The page number of the results to retrieve. Default is 1.

ItemsPerPage

int
Optional

The number of items per page. Default is 10.

SearchQuery

string
Optional

A search string to filter challenges by name.

OrderBy

string
Optional

The field to order the results by. Default is Id.

IsAscending

bool
Optional

A flag indicating whether the results should be ordered in ascending order. Default is true.

Request Example

GET /api/v1/Integration/Challenges/GetChallengesInfoForUser?Page=1&ItemsPerPage=10&SearchQuery=badge&OrderBy=StartDate&IsAscending=true&UserId=12345&CategoryId=5

Response

Returns a challenge object if successful. Otherwise, return status Code message error.

Response Fields:

  • data (List): A list of challenges.

  • pagesNum (int): The current page number.

  • count (int): The total number of challenges matching the criteria.

Response Parameters

PropertyTypeDescription

Id

int

Unique identifier for the challenge.

Name

string

The name of the challenge.

Description

string

Brief summary of the challenge.

Startdate

datetime

Challenge start date.

Enddate

datetime

Challenge end date.

EndsAfter

int

Days left until the challenge ends.

PeopleFinished

int

Number of people that completed the challenge.

IsLocked

bool

If isLocked equals 1 it waits until the parent challenge is achieved.

Category*

object

Category info of the challenge.

Image

string

The URL for the challenge's image.

Category: Category information of the challenge.

PropertyTypeDescription

Id

int

Unique identifier of the category.

Name

string

Name of the category.

Response Sample

Success respone
{
    "result": {
        "data": [
            {
                "name": "Voucher Challenge",
                "description": "This is a challenge with reward type voucher to showcase on the documentation.",
                "startDate": "2024-08-12T11:03:00",
                "endDate": "2024-08-28T11:03:00",
                "endsAfter": 15.0,
                "peopleFinished": 0,
                "image": "https://storage.googleapis.com/dsq-staging/staging/Gamification/images/Staging/Challenges/Voucher%20Challenge_1.jpg?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=upload-service%40warm-ring-360408.iam.gserviceaccount.com%2F20240812%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20240812T111026Z&X-Goog-Expires=21600&X-Goog-SignedHeaders=host&X-Goog-Signature=0b14766b6008f06e0c0087ecd3e320309e2a2a4b4c49035bc5eaad5469e3761081c3c43f89e6cfed8f931badbfe5f553f89886bf822ffebe963dd49bb5630e27faa81c25bc1bbd28f803ef150a182a69922574bf64c339537374e98e57c1a497f0887b1d3451d8313afbb9dbb23529f1daee98ca3903819be5bd3094ad7e812b4f2909a57b132fb0d5b6899cadf06b6ca4b488417130e11f54d6823fae2d1567a8bcfc39ba9e8f07b52dedbc7139c8d3e7fe13b7c65762adc4af1cfd3153e0ad475c87c06af3bf3c1f6f9016a5199738c051601b338cccc38fd6d29ff791ceeeb1e1a8743b8e8c0b9c3130f1bed440e1a13bcb1051ddf1cc0f8605bf34f5d1e7",
                "category": {
                    "name": "Food",
                    "id": 1
                },
                "isLocked": false,
                "id": 308
            }
        ],
        "count": 1,
        "pagesNum": 1
    },
    "message": "Process completed successfully",
    "statusCode": 1,
    "statusName": "Successfully"
}

Notes

  • The API supports pagination and sorting to handle large datasets efficiently.

  • Challenge images are retrieved with pre-signed URLs for secure access.

  • Challenges are filtered to exclude those that are not visible or limited challenges that have claimed milestones.

Last updated