POST GetDetailsById

{baseurl}/api/v1/Integration/GetDetailsById

Overview

The GetDetailsById API endpoint retrieves the detailed information of a specific challenge based on the provided ChallengeId and UserId.

The returned data includes challenge metadata, milestones, prizes, rewards, group progress, and trigger progress, along with additional details about any locked parent challenges.

This API works only with challenges that have points and voucher reward types. For Badge challenge details check GetBadgeDetailsById.

Use Cases Examples:

  1. Basic Challenge Retrieval: Retrieve details for a specific challenge using the challenge ID and user ID.

  2. Locked Challenge Handling: Fetch and display challenge details, even when it is locked, showing parent challenge information.

  3. User Progress Tracking: Track user progress, including milestones, rewards, and triggers within a challenge.

  4. Multi-Language Support: Retrieve challenge resources like name and description based on the user's preferred language.


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.

Body Parameters

PropertyTypeOptionsDescription

UserId

string
Required

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

ChallengeId

int
Required

Unique identifier for the challenge.

Body Sample

{
  "challengeId": 1,
  "userId": "0123456789"
}

Response

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

Response Fields:

  • data (List): Challenge object.

  • 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.

PeopleFinished

int

Number of people that completed the challenge.

EndsAfter

int

Days left until the challenge ends.

IsLocked

bool

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

LockedEvent

object

Details of the parent challenge if the current challenge is locked.

Category*

object

Category info of the challenge.

Image

string

The URL for the challenge's image.

Prizes*

list

List of milestones that users have on that challenge.

GroupProgress*

list

An object that shows user progress over the triggers group.

Rewards*

object

List of rewards that user won over that challenge.

Category: Category information of the challenge.

PropertyTypeDescription

Id

int

Unique identifier of the category.

Name

string

Name of the category.

Rewards (Object): List of rewards that user won over that challenge.

PropertyTypeDescription

RewardId

int

The unique identifier of the reward.

RewardName

string

The name of the reward.

Duration

int

The duration for which the reward is valid.

DurationType*

enum

The type of duration (e.g., Days, Months).

RewardType*

enum

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

RewardValue

string

The value of the reward (e.g., 10% Off).

Prizes (List of Milestones): The milestones won on the challenge.

PropertyTypeDescription

User ID

string

User phone number associated with the milestone.

MilestoneId

int

ID of the milestone associated with the prize

Prizes*

list

List of prize details, The prize appears only when it is not claimed, once claimed, it moves to history.

Prizes (List of Prizes): List of prize details

PropertyTypeDescription

Value

string

Value of the prize, either be points amount or voucher code.

ExpirationDate

datetime

Expiration date of the prize.

Description

string

Description of the prize.

RewardType*

enum

Type of reward.

LockedEvent (Object): Details of the parent challenge if the current challenge is locked.

PropertyTypeDescription

Id

int

The unique identifier of the parent challenge.

Name

string

The name of the parent challenge.

Description

string

A brief description of the parent challenge.

StartDate

datetime

The start date of the parent challenge.

EndDate

datetime

The end date of the parent challenge.

Image

string

URL to the parent challenge image.

GroupProgress (List of Triggers Groups): Progress of triggers groups within the challenge.

PropertyTypeDescription

GroupId

int

Unique identifier of the group.

GroupOrder

int

Order of the group.

Operator*

enum

Logical operator used between groups (e.g., AND, OR).

TriggersProgress*

list

List of triggers within the group.

TriggersProgress (List of Triggers Progress): Progress of individual triggers within the challenge.

PropertyTypeDescription

TriggerId*

int

Unique identifier of the trigger.

TriggerType*

enum

Type of the trigger (e.g., Voucher, Points).

TriggerName

string

Name of the trigger.

TriggerOrder

int

Order of the trigger within the group.

Operator*

enum

Logical operator used between triggers (e.g., AND, OR).

TriggerFrequency

decimal

The amount of actions required to complete the trigger.

ActionLeft

decimal

Number of actions left to complete the trigger.

Progress

decimal

Progress percentage of the trigger.

TriggerId Values

  • Earned Points = 1

  • Subscribe Vouchers Count = 2

  • Redeemed Points = 3

  • Redeemed Vouchers Count = 4

  • Total Points Balance = 5

  • Hit tier = 6

Enums

Operator

  • And = 1

  • Or = 2


enum OperatorEnum
{
    And = 1,
    Or = 2,
}

Response Sample

Success respone
{
    "result": {
        "name": "Voucher Challenge",
        "description": "This is a challenge with reward type voucher to showcase on the documentation.",
        "peopleFinished": 5,
        "isLocked": false,
        "category": {
            "name": "Food",
            "id": 1
        },
        "endsAfter": 14,
        "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=20240813T140009Z&X-Goog-Expires=21600&X-Goog-SignedHeaders=host&X-Goog-Signature=6940e961cf662fdd5bb4bfd4f45b2a4d73dc168ae62124ed309b3cc3c1cfcd824dfb91a458c70f53cec3e761d1aad43392cb4e13108c9b9708734ef6f411751d5e16b22c0ceac677bce667ab9c9160958c40dff7ba36b6c289c5747469cf7e50462dfa43f43d208016932212f4ab0fffca9db8c6adeb875b38872741438b8446baa048e921ab7c259a7a57929b894b5e5c76d7a0613b1ca45ceebe21c7d802a596b3a003a1568bdea296eb29f762ee85d4142ba12038986ff2b8682086498993e5a8b32dc5da011dd36b5cca16312b2bad8ff885195a86c6d3aa8a9bc7ba73112a5b851781eb942b9ab9e24b6d01ba9219da5a3e617e733c153c262fc63777f6",
        "prizes": [
            {
                "userId": "01010123422",
                "milestoneId": 564,
                "prizes": [
                    {
                        "value": "Ga652407111953",
                        "description": "you have won 40% off Buffalo Burger",
                        "expirationDate": "2024-12-31T00:00:00",
                        "rewardType": 1
                    }
                ]
            }
        ],
        "groupProgress": [
            {
                "groupId": 305,
                "operator": 1,
                "groupOrder": 1,
                "triggersProgress": [
                    {
                        "triggerName": "Earned Points",
                        "triggerId": 1,
                        "triggerFrequency": 1000.0000,
                        "triggerOrder": 1,
                        "progress": 0.0,
                        "operator": 1,
                        "actionLeft": 1000.0000,
                        "triggerType": 2
                    }
                ]
            }
        ],
        "rewards": [
            {
                "challengeId": 0,
                "rewardId": 1,
                "rewardName": "Reward Voucher",
                "rewardValue": "600",
                "rewardType": 1,
                "duration": 0,
                "durationType": 1,
                "dateCreated": "2024-12-31T00:00:00",
                "id": 0
            }
        ],
        "id": 308
    },
    "message": "Process completed successfully",
    "statusCode": 1,
    "statusName": "Successfully"
}

Additional notes

  • Prizes object only holds the prize if it is not claimed, once claimed it will be empty and prize moves to history.

Last updated