Setting the loyalty level of a user
Contents
- Overview
- Version-specific information
- Permissions and Authentication
- Headers
- HTTP Parameters
- Sample request
- Sample response
- Possible error responses
Overview
- Call name: alter-user-loyalty-level
- Endpoint URL: https://api0.spaaza.com/auth/alter-user-loyalty-level
- Request methods: PUT
- Request Content-Type:
application/json
orapplication/x-www-form-urlencoded
* - Response Content-Type:
application/json
- Auth required: yes
* In the case of a JSON payload (application/json
) all parameters are top-level elements.
This endpoint allows changing the loyalty level of a user in the Spaaza system. The new loyalty level must be associated with the same chain as the user’s MyPrice app. The change can be performed either by an admin user with write access or through privileged authentication.
Version-specific information
The following version-specific changes apply to this endpoint. See the versioning page for more details.
Version | Change details |
---|---|
N/A | N/A |
Permissions and Authentication
This API call requires one of the following authentication methods:
- Admin authentication: the performing user needs to be logged in and have
write access
to the chain to which the user is connected. - Privileged authentication: the use of privileged authentication is permitted for this endpoint. For privileged authentication, the
X-Spaaza-MyPrice-App-Hostname
header must be passed in the request.
Headers
The following headers can/must be passed to the API call:
Parameter | Description |
---|---|
X-Spaaza-MyPrice-App-Hostname | (mandatory when using privileged authentication) The hostname of the app which the user is associated with. |
X-Spaaza-Request | (optional) Can be used to record the signup channel. |
HTTP Parameters
The following HTTP parameters can be passed to the API:
Parameter | Description |
---|---|
user_id | (integer, mandatory unless member_number is supplied) The ID of the user (programme member) in the Spaaza system. Must be a valid integer. If member_number is supplied, this parameter should not be used. |
member_number | (string, mandatory unless user_id is supplied) The member number in the programme of the user whose loyalty level is being changed. If user_id is supplied, this parameter is not needed as user_id takes precedence. |
loyalty_level_id | (integer, mandatory) The ID of the loyalty level to assign to the user. Must be a valid integer and must reference a loyalty level that exists and is associated with the same chain as the user’s MyPrice app. |
Sample request
{
"user_id": 4232324,
"loyalty_level_id": 123
}
Or using member number:
{
"member_number": "20000000001",
"loyalty_level_id": 123
}
Sample response
Returns an OK code and information about the updated loyalty level:
{
"result": {
"code": 1,
"status": "ok"
},
"results": {
"user_loyalty_level_progress": {
"loyalty_level": {
"id": 123,
"campaign_id": 123123,
"name": "VIP",
"description": "VIP level in the Loyalty Programme",
"automated_level_logic": 0
},
"created_datetime": "2025-01-15T10:30:00+00:00",
"notes": "Manual level change"
},
"result_type": "alter-user-loyalty-level"
}
}
Possible error responses
The following represents a list of possible error responses for the alter-user-loyalty-level
endpoint:
Code | Name and Description | HTTP Status Code |
---|---|---|
52 | missing_necessary_parameters The loyalty_level_id parameter is missing | 400 |
154 | user_id_invalid The supplied user_id is not a valid integer | 400 |
230 | entity_not_found The specified loyalty level does not exist | 400 |
270 | user_not_found The specified user could not be found | 404 |
405 | entity_mismatch The loyalty level is not associated with the user’s chain | 400 |
423 | parameter_supplied_not_integer The loyalty_level_id parameter is not a valid integer | 400 |