post https://{host}/api_gateway/v1/badges/customer/earnBulk
This API allows you to issue badges to multiple customers at once.
Note
For detailed information about our APIs and for hands-on testing, refer documentation in API overview and step-by-step guide on making your first API call in Make your first API call .
API endpoint example
https://eucrm.cc.capillarytech.com/api_gateway/v1/badges/customer/earnBulk
Prerequisites
- Authentication: Basic or OAuth authentication
- Default access group
Resource information
URI | api_gateway/v1/badges/customer/earnBulk |
HTTP method | POST |
Pagination | NA |
Rate limit | NA |
Batch support | NA |
Request body parameters
{
"data": {
"h-0": "Parameter",
"h-1": "Datatype",
"h-2": "Description",
"0-0": "badgeMetaId",
"0-1": "String",
"0-2": "Unique identifier (\"id\") generated during the badge creation.",
"1-0": "customerIds\\*",
"1-1": "Array",
"1-2": "A list of unique identifiers for customers. To issue bulk badges, pass multiple customerId in an array.",
"2-0": "requestId",
"2-1": "String",
"2-2": "Enter a unique identifier to identify the request.",
"3-0": "triggeredBy",
"3-1": "Object",
"3-2": "Object containing information about the trigger source for the badge issue.",
"4-0": "\\- ownerType\\*",
"4-1": "Enum",
"4-2": "The module for which the badge is being issued. \nSupported values: Loyalty, Loyalty_Promotion, Referral_Campaigns, Journeys, Audience_Campaigns, Rewards_Catalog, Goodwill_Module, Milestones, Historical_Import",
"5-0": "earnEvenrDate",
"5-1": "Date",
"5-2": "The date on which the customer performed the activity. Earn event date has to be between the badge start date and end date if it is a direct earn type of badge and it has to be between the badge issual start date and end date if it is an issue & earn type of badge. \nYou can also enter a past date. This can be used to issue a badge against an older transaction.",
"6-0": "\\- referenceId\\*",
"6-1": "String",
"6-2": "Enter a unique identifier to identify the owner (ownerType). The referenceId passed here should be the same as the referenceId in the [claim badge API](https://docs.capillarytech.com/reference/claim-badge) ."
},
"cols": 3,
"rows": 7,
"align": [
null,
null,
null
]
}
{
"badgeMetaId": "653de334b3cda7078c7c68eb",
"customerIds": [
62090013,553162563
],
"requestId": "1234",
"earnEventDate":"2023-11-03T21:51:00.192Z",
"triggeredBy": {
"ownerType": "Loyalty",
"referenceId": "123457"
}
}
Response parameters
{
"data": {
"h-0": "Parameter",
"h-1": "Datatype",
"h-2": "Description",
"0-0": "data",
"0-1": "Object",
"0-2": "The main container for the badge issue details.",
"1-0": "\\- badgeMetaId",
"1-1": "String",
"1-2": "Unique identifier (\"id\") generated during the badge creation.",
"2-0": "\\- triggeredBy",
"2-1": "Object",
"2-2": "Object containing information about the trigger source for the badge issue.",
"3-0": "\\-- ownerType",
"3-1": "Enum",
"3-2": "The module for which the badge is being issued. \nSupported values: LOYALTY/REFERRAL_CAMPAIGNS/JOURNEYS/AUDIENCE_CAMPAIGNS/ \nREWARDS_CATALOG/ GOODWILL_MODULE/ MILESTONES.",
"4-0": "\\-- referenceId",
"4-1": "String",
"4-2": "A unique identifier to identify the owner (ownerType).",
"5-0": "\\- expiresOn",
"5-1": "Date",
"5-2": "Unix timestamp indicating when the badge issuance expires.",
"6-0": "\\- issuedBadges",
"6-1": "Array",
"6-2": "A list of objects each representing a badge issued to a customer.",
"7-0": "\\-- customerId",
"7-1": "Integer",
"7-2": "Unique identifier for the customer who received the badge.",
"8-0": "\\-- issuedId",
"8-1": "String",
"8-2": "A Unique identifier representing the specific issuance instance of the badge.",
"9-0": "\\-- status",
"9-1": "Enum",
"9-2": "Indicates the current state of the badge. Supported values: \nLIVE: The badge is currently available for redemption. \nUPCOMING: The badge will be available in the future. \nEXPIRED: The badgeis no longer available.",
"10-0": "\\- requestId",
"10-1": "String",
"10-2": "A unique identifier to identify the request.",
"11-0": "errors",
"11-1": "Array",
"11-2": "A list of any errors that occurred.",
"12-0": "warnings",
"12-1": "Array",
"12-2": "A list of warnings. "
},
"cols": 3,
"rows": 13,
"align": [
null,
null,
null
]
}
{
"data": {
"badgeMetaId": "653de334b3cda7078c7c68eb",
"triggeredBy": {
"ownerType": "Loyalty",
"referenceId": "123457"
},
"expiresOn": 1717935013.121711000,
"issuedBadges": [
{
"customerId": 553162563,
"issuedId": "661681a535bc684e9e72553a",
"status": "EXPIRED"
},
{
"customerId": 62090013,
"issuedId": "661681a535bc684e9e72553b",
"status": "LIVE"
}
],
"requestId": "1234"
},
"errors": [],
"warnings": []
}
Failure: Badge Overlapping
{
"data": {
"badgeMetaId": "66f3be92a8647e03dc526a5f",
"triggeredBy": {
"ownerType": "Loyalty",
"referenceId": "xyz"
},
"expiresOn": 1722155344.000000000,
"issuedBadges": [
{
"customerId": 11115,
"issuedId": "66f3bf91c7bf1e4d65e126b1",
"error": {
"code": 1040,
"message": "An active issue for the badge already exists.",
"reference": null
},
"status": "EXPIRED"
}
],
"requestId": "VGagtK2zN16jkRU56zs1"
},
"errors": [],
"warnings": []
}
API-specific errors
Error code | Description |
---|---|
809 | Request with the same requestId is not allowed. |
810 | The badge needs to be claimed first using the claim badge API. |
1040 | An active issue for the badge already exists. |