Retrieve Cart Items
Adds a new product to the cart or increases quantity if the product already exists.
HTTP Request
GET/api/shop/cart/items/:id
Authorization
Authorization
- Required: Yes
- Permission: Authenticated User
- Authentication: Token-based (Authorization: Token <your_api_key>)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | Integer | Yes | ID of the cart item to retrieve |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| product | Integer | Yes | Product ID to add to cart |
| quantity | Integer | No | Quantity to add (default: 1, minimum: 1) |
| notes | String | No | Customer notes for this item (max 500 chars) |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2
3response = requests.get('http://www.example.com/api/shop/cart/items/789',
4 headers={'Authorization': 'Token <your_api_key>'}
5)
6print(response.json())1curl "http://www.example.com/api/shop/cart/items/789" -H "Authorization: Token <your_api_key>"Status Codes
| Code | Description |
|---|---|
| 200 | Items retrieved successfully |
| 401 | Unauthorized — authentication required |
| 404 | Item not found |
| 500 | Internal server error |
Response Fields
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the cart item |
| ref | String | Item reference (read-only) |
| product | Object | Product information with `id`, `name`, `image` |
| quantity | Integer | Item quantity |
| notes | String | Customer notes for this item |
| created_at | String (ISO 8601) | Timestamp when item was added |
| updated_at | String (ISO 8601) | Timestamp when item was last updated |
| unit_price | Integer | Price per unit (read-only) |
| unit_discount | Integer | Discount per unit (read-only) |
| subtotal | Integer | Item subtotal before discount (read-only) |
| discount | Integer | Total item discount (read-only) |
| total | Integer | Final item total (read-only) |