GET GetChallengeHistoryForUser

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

Overview

The GetChallengeHistoryForUser API endpoint retrieves the history of challenges completed by a specific user, including details about rewards earned, their status, and the date of expiration.

Use Cases Examples:

  1. Retrieving a User's Challenge History:

    • This API fetches the history of challenges completed by a specific user, including the details of rewards earned and their statuses.

  2. Display Reward History in User Profile:

    • The response can be used to display a timeline or history of challenges completed by the user, showing the rewards they've earned and their current statuses (e.g., expired, active).

  3. Reward Expiration Management:

    • The API automatically updates the status of rewards (e.g., marking them as expired if the expiration date has passed). This ensures users only see valid and up-to-date information about their rewards.


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.

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/GetChallengeHistoryForUser?Page=1&ItemsPerPage=10&SearchQuery=badge&OrderBy=StartDate&IsAscending=true&UserId=12345

Response

Returns an object with rewards details 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

ChallengeId

int

Unique identifier for the challenge.

ChallengeName

string

The name of the challenge, based on the user's preferred language.

DateCreated

datetime

The date and time when the challenge was completed.

Image

string

The URL for the challenge's image.

Rewards*

list

A list of rewards earned from the challenge.

Rewards (list): A list of rewards earned from the challenge.

ParameterTypeDescription

Name

string

The name of the reward.

RewardType*

enum

The type of the reward (e.g.,Voucher, Points).

RewardValue

string

The value of the reward (e.g., points, voucher value).

RewardDiscription

string

A description of the reward.

Status*

enum

A list of rewards earned from the challenge.

ExpirationDate

datetime

The status of the reward (e.g., Active, Expired, Burnt).

DateCreated

datetime

The date when the reward was granted.

Enums

Reward Type

  • Voucher = 1

  • Points = 2

  • Badge = 3


enum RewardType
{
    Voucher = 1,
    Points = 2,
    Badge = 3
}

Response Sample

Success respone
{
    "result": {
        "data": [
            {
                "challengeId": 308,
                "challengeName": "Voucher Challenge",
                "rewards": [
                    {
                        "rewardValue": "Ga831886756298",
                        "rewardDiscription": "you have won 40% off Buffalo Burger",
                        "name": "Reward Voucher",
                        "expirationDate": "2024-12-31T00:00:00",
                        "rewardType": 1,
                        "status": 1,
                        "dateCreated": "2024-08-12T12:11:06"
                    },
                    {
                        "rewardValue": "Ga314736327726",
                        "rewardDiscription": "you have won 40% off Buffalo Burger",
                        "name": "Reward Voucher",
                        "expirationDate": "2024-12-31T00:00:00",
                        "rewardType": 1,
                        "status": 1,
                        "dateCreated": "2024-08-12T11:44:28"
                    }
                ],
                "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%2F20240813%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20240813T135622Z&X-Goog-Expires=21600&X-Goog-SignedHeaders=host&X-Goog-Signature=1539505f98030d8cea529727d9c20ccd8b01ea810593ffc451cbb4cbf250b8d195187c6c8a3e59504cf097c2d7bb28d2fa17e6863d6bfcd7714d103d17039518bcaf502f01bfed6a5052eb1d22174a2d6543159726d644a765098564354c90c4ab55360be5bc01244fd78d60bc345145d708840b92637241ee57f1fd0b24e5bbfab04101553534c15a44be554a4a0db3ed791e326eff08eb575a13180f84ae1ef5e9d3e67d5dd90be3a3c621a351f0074cdc3ed3158c8c1fcc55e3eb1d8e4b5efe71a2eadb0f61353dfa53bd18449aca276918deac57c115269a6e12c2780471da63e404d3e1709b349f1b02925ea989b0fefad8581a02404adccffc9762ed1f",
                "dateCreated": "2024-08-12T12:11:06"
            },
            {
                "challengeId": 301,
                "challengeName": "Challenge for all",
                "rewards": [
                    {
                        "rewardValue": "Ga400561085262",
                        "rewardDiscription": "you have won 100 LE off Metro Market",
                        "name": "Reward Voucher",
                        "expirationDate": "2025-03-31T00:00:00",
                        "rewardType": 1,
                        "status": 1,
                        "dateCreated": "2024-08-12T11:18:59"
                    }
                ],
                "image": "https://storage.googleapis.com/dsq-staging/staging/Gamification/images/Staging/Challenges/Challenge%20for%20all_1.jpg?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=upload-service%40warm-ring-360408.iam.gserviceaccount.com%2F20240813%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20240813T135622Z&X-Goog-Expires=21600&X-Goog-SignedHeaders=host&X-Goog-Signature=b03fe1d017a7d5b19f621b263981476a2d9ef2ad14625527383e38edc91ef9e3d1f7505348a1e3f64b48743a03ba36b9999bff5ecec6fbb2df4813cb0ba3336736261e15274063cab0fb87d30e5e1587d8f2383e138030ed832b2be6e44a337aa8c3ed2115c98b8df5c4faf0b2b63fc821c5d9b3055d7e763eec3558a673bc4196d4bfd0638d38253d2c0f84c026e4153bfcbbd046f5ffa535fbdfb48c4fdc1b0ce4077b9a028121c352626d392b3004585967b8f7fd4cf97fb59d09ee08994c5469fdc665100be06379c7e80e3e386579cd78080ba96a2381ac00180524214262c9a8b71af7c1a763acb60ff53b9d0bc9c85d142a858f26d2fa04ca90ae2c47",
                "dateCreated": "2024-08-12T11:18:59"
            }
        ],
        "count": 2,
        "pagesNum": 1
    },
    "message": "Process completed successfully",
    "statusCode": 1,
    "statusName": "Successfully"
}

Last updated