Bulk change redeemed rewards’ status
Open Loyalty has the JWT authorization. To learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens https://jwt.io/introduction/
Obtain an access token
Send a request with the parameters username and password
Definition
POST /api/admin/login_check Go to definition
POST /api/{storeCode}/member/login_check Go to definition
Example
curl {HOST}/api/admin/login_check
-H 'Content-Type: application/json;charset=UTF-8'
-H 'Accept: application/json, text/plain, */*'
--data-binary '{"username":"admin","password":"password"}'
Example Response
{
"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6...",
"refresh_token":"0558f8bb29948c4e54c443f..."
}
Using JSON Web Token
Add authorization header to each request
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...
You can now access any API method you want under the /api prefix.
Example
curl {HOST}/api/{storeCode}/analytics/members
-H 'Accept: application/json'
-H 'Content-type: application/x-www-form-urlencoded'
-H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'
Refresh JSON Web Token
You can refresh token using refresh_token that was given during login.
There are two endpoints
To refresh admin token POST /api/token/refresh Go to definition
To refresh member token POST /api/{storeCode}/token/refresh Go to definition
Store code
List of groups. Each group applies its status (and optional comment) to its own issuedRewardIds, so a single request can set different statuses for different rewards. The total number of issued reward ids across all groups must not exceed a configurable limit; exceeding it rejects the whole request with a 400.
The constraints below describe valid input. Violating one of the per-item constraints — an unknown status, a comment over 255 characters, or an issuedRewardIds entry that is not a uuid — is not rejected with a 400: the request is accepted and that item is reported as failed in the response.
IDs of the issued rewards that should receive this group's status.
Status to apply to every issued reward in this group.
Comment related to the status change (optional).
Per-item report of the bulk status change.
ID of the issued reward this report line refers to. Rows appear in the order the ids were submitted, one row per submitted id, so a repeated id appears once per occurrence. A uuid is required here and is what every row carries, with one exception: a row rejected with invalid_issued_reward_id echoes the submitted value back verbatim, since that is the only way for the caller to recognise which of its inputs was rejected.
Whether the status change succeeded for this issued reward.
Per-item failure reason; null (and omitted) when ok is true. Field-level problems that belong to one item are reported here rather than rejecting the request, so a 200 response can still contain failed rows.
Bad request.
Unauthorized
Forbidden.
Not found.
POST /api/{storeCode}/redemption/status/bulk HTTP/1.1
Host: openloyalty.localhost
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 97
[
{
"issuedRewardIds": [
"123e4567-e89b-12d3-a456-426614174000"
],
"status": "issued",
"comment": "text"
}
][
{
"issuedRewardId": "text",
"ok": true,
"error": "issued_reward_not_found"
}
]Last updated
Was this helpful?

