Update item quantity in cart
Description
This service updates the quantity of a specific item already in the cart for a given mileage activity.
Request
Restrictions
This service requires an authenticated user. The logged-in consumer or operator must have the necessary permissions enabled for this service.
Endpoint
PUT https://<server-url>/api/v4/mileage/{activity_code}/cart/items/{item_code}Path Parameters
activity_code
String
The unique code for the mileage activity.
item_code
String
The unique code of the item in the cart to update.
Parameters
touchpoint
Query / Header
The identifier for the touchpoint. Use Thalamus-Touchpoint for the header.
token
Query / Header
The authentication token for the API session. Use Thalamus-Token for the header.
Full URL Example
https://<server-url>/api/v4/mileage/MPOINTS/cart/items/CD?touchpoint=test&token=...Request Body
The body of the request must specify the new quantity for the item.
quantity
Integer
The new number of units for the item. A quantity of 0 will remove the item from the cart.
JSON
{
"quantity": 8
}Response
✅ Successful Response: 201 Created
201 CreatedThe item's quantity was successfully updated. The response returns the updated session context, reflecting the new cartTotal and accountBalance in the personStatus object.
JSON
{
"context": {
"links": [
{
"ref": "home",
"href": "http://localhost:8080/thalamus/api/v1/people/home"
}
],
"activities": [
{
"code": "MPOINTS",
"name": "ML Points",
"message": "This is a message",
"type": "MILEAGE",
"personStatus": {
"accountBalance": 100,
"accountLeft": 20,
"cartTotal": 80,
"quantityItemsInCart": 8
}
}
],
"simpleProfile": {
"firstname": "test",
"lastname": "test",
"email": "[email protected]"
}
}
}❌ Unsuccessful Response: 400 Bad Request
400 Bad RequestReturned if the item is invalid (e.g., requested quantity exceeds stock) or the consumer has insufficient points for the new total.
JSON
{
"errors": {
"item": "InvalidID",
"account": "NotEnoughPoints"
}
}❌ Unsuccessful Response: 404 Not Found
404 Not FoundReturned if the specified activity_code or item_code does not exist in the cart.
JSON
{
"errors": {
"error.message": "NOT_FOUND"
}
}Last updated
Was this helpful?
