Create Attribute Values
Creates a new value for a specific product attribute.
HTTP Request
POST/api/products/attributes/:attribute_id/values
Authorization
Authorization
- Required: Yes
- Permission: Staff or Admin
- Authentication: Token-based (Authorization: Token <your_api_key>)
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| value | String | Yes | The value of the attribute |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2
3# Create a new attribute value
4response = requests.post('http://www.example.com/api/products/attributes/123/values',
5 headers={'Authorization': 'Token <your_api_key>'},
6 json={'value': 'New Attribute Value'}
7)
8print(response.json())1# Create a new attribute value
2
3curl -X POST "http://www.example.com/api/products/attributes/123/values" -H "Authorization: Token <your_api_key>" -H "Content-Type: application/json" -d '{"value": "New Attribute Value"}'Status Codes
| Code | Description |
|---|---|
| 201 | Attribute value created successfully |
| 400 | Bad request — invalid input |
| 401 | Unauthorized — authentication required |
| 403 | Forbidden — insufficient permissions |
| 404 | Not found — attribute does not exist |
| 500 | Internal server error |
Response Fields
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the attribute value |
| value | String | The value of the attribute |
| created_at | String (ISO 8601) | Timestamp when attribute value was created |
| updated_at | String (ISO 8601) | Timestamp when attribute value was last updated |