POST GetBadgeDetailsById

{baseurl}/api/v1/Integration/GetBadgeDetailsById

Overview

The GetBadgeDetailsById API endpoint retrieves the detailed information of a specific badge 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.

Badge challenge details

This API works only with challenges that have a badge reward type. For points and voucher reward challenge details check GetDetailsById.

Use Cases Examples:

  1. Display Badge and Reward Information: Retrieves and displays badge-related information and rewards available in a challenge, customized to the user's progress and achievements.

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

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

  4. Determine Challenge Lock Status: Checks if a challenge is locked for a user based on their progress in related parent challenges, providing the user with details on how to unlock it.

Badge challenge details

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 badge challenge.

Body Sample

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

Response

Returns a challenge object if success. 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.

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.

ParameterTypeDescription

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
```json
{
    "result": {
        "name": "Most Loyal",
        "description": "Most Loyal badge",
        "peopleFinished": 1,
        "isLocked": false,
        "category": {
            "name": "Sports",
            "id": 3
        },
        "endsAfter": 1,
        "image": "https://storage.googleapis.com/dsq-staging/staging/Gamification/images/Staging/Challenges/Most%20Loyal_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=20240813T140201Z&X-Goog-Expires=21600&X-Goog-SignedHeaders=host&X-Goog-Signature=afd8f06f6a452df6b7dbb758f8769cbd3c4c1be54749df6e3fe6899d90b505982b8ff2bed2b170976f1ad125c5a3c2d798d3fa6278ffd7a68e351404b893a11aac2677eb004129659a195e205d76bda2e49a56ca1e2de6dda40efb5d8ce02b78a1310a765f91d66cfa452450728527237e024c45af5cb86fe6344f8b191cdfebe8bb950409f6a505b5dcf7c34145a4307955bbf7af40d97defa7092ab974dd75e19e31cbbb708c62d61506e3cc732ce094c2ab335088ce24939fc8926b19052c289de9834d4923c2bbf7c30884b9839fa07402d8e18bc77c0e52cf28841a858f56a4cd8b063ee7ba64921e70bcf58042591a0d219882023895f70b8c05195388",
        "prizes": [
            {
                "userId": "01010123422",
                "milestoneId": 565,
                "prizes": []
            }
        ],
        "groupProgress": [
            {
                "groupId": 314,
                "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": 3,
                "rewardName": "Food lovers
 Badge",
                "rewardValue": "Badges",
                "rewardType": 3,
                "duration": 0,
                "durationType": 1,
                "dateCreated": "2024-12-31T00:00:00",
                "id": 0
            }
        ],
        "id": 317
    },
    "message": "Process completed successfully",
    "statusCode": 1,
    "statusName": "Successfully"
}
```

Last updated