curl --request POST \
--url {protocol}://{host}/v2/loyalties/programs/{programId}/earning-rules/batch \
--header 'Content-Type: application/json' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>' \
--data '
{
"assign": [
{
"id": "<string>"
}
],
"unassign": [
{
"id": "<string>"
}
]
}
'{
"assigned": [
{
"earning_rule_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"object": "program_earning_rule"
}
],
"unassigned": [
{
"earning_rule_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"object": "program_earning_rule"
}
]
}{
"code": 123,
"key": "<string>",
"message": "<string>",
"details": "<string>",
"request_id": "<string>",
"resource_id": "<string>",
"resource_type": "<string>"
}{
"code": 123,
"key": "<string>",
"message": "<string>",
"details": "<string>",
"request_id": "<string>",
"resource_id": "<string>",
"resource_type": "<string>"
}{
"code": 123,
"key": "<string>",
"message": "<string>",
"details": "<string>",
"request_id": "<string>",
"resource_id": "<string>",
"resource_type": "<string>"
}{
"code": 123,
"key": "<string>",
"message": "<string>",
"details": "<string>",
"request_id": "<string>",
"resource_id": "<string>",
"resource_type": "<string>"
}{
"code": 123,
"key": "<string>",
"message": "<string>",
"details": "<string>",
"request_id": "<string>",
"resource_id": "<string>",
"resource_type": "<string>"
}Batch assign/unassign earning rules
This documentation is in progress. The parameters, fields, request and response bodies, and other data may be subject to change. If you need more information or you want to share feedback, contact Voucherify support or your Technical Account Manager.
Assigns and/or unassigns earning rules to/from a program in a single batch.
Unassign operations are processed before assign operations. When the program is
ACTIVE, the batch is validated to leave at least one active earning rule assigned.
In strict mode (default) missing earning rules or missing assignments cause the whole
batch to fail.
A valid request URL is required to generate request examples{
"assigned": [
{
"earning_rule_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"object": "program_earning_rule"
}
],
"unassigned": [
{
"earning_rule_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"object": "program_earning_rule"
}
]
}{
"code": 123,
"key": "<string>",
"message": "<string>",
"details": "<string>",
"request_id": "<string>",
"resource_id": "<string>",
"resource_type": "<string>"
}{
"code": 123,
"key": "<string>",
"message": "<string>",
"details": "<string>",
"request_id": "<string>",
"resource_id": "<string>",
"resource_type": "<string>"
}{
"code": 123,
"key": "<string>",
"message": "<string>",
"details": "<string>",
"request_id": "<string>",
"resource_id": "<string>",
"resource_type": "<string>"
}{
"code": 123,
"key": "<string>",
"message": "<string>",
"details": "<string>",
"request_id": "<string>",
"resource_id": "<string>",
"resource_type": "<string>"
}{
"code": 123,
"key": "<string>",
"message": "<string>",
"details": "<string>",
"request_id": "<string>",
"resource_id": "<string>",
"resource_type": "<string>"
}Authorizations
Path Parameters
Unique program identifier.
^lprg_[a-f0-9]+$Body
Batch of earning rule assignment operations. unassign operations are processed
before assign operations. Duplicate ids within a batch are rejected.
Response
Batch processing result.
Result of an earning rule assignment batch. Keys are null when the corresponding operation list was not provided.
Was this page helpful?

