Skip to main content

List Product Attributes

Retrieves a list of all product attributes with filtering, searching, and ordering capabilities.

HTTP Request

GET/api/products/:product_id/attributes

Authorization

Authorization

  • Required: Yes
  • Permission: Staff or Admin
  • Authentication: Token-based (Authorization: Token <your_api_key>)

Path Parameters

ParameterTypeRequiredDescription
product_idIntegerYesUnique ID of the product

Query Parameters

ParameterTypeDefaultDescription
limitinteger10Number of results to return per page
offsetinteger0Number of results to skip before returning results
searchstringSearch by `attribute__id`, `attribute__name`, `attribute__description`
orderingstringOrder by `attribute__id`, `attribute__name`, `attribute__created_at`, `attribute__updated_at`, `created_at`, `updated_at`, `product__id`, `product__name`

Example Requests

1import requests
2
3# List all product attributes
4response = requests.get('http://www.example.com/api/products/123/attributes',
5  headers={'Authorization': 'Token <your_api_key>'}
6)
7print(response.json())
8
9# Search and filter attributes
10response = requests.get('http://www.example.com/api/products/123/attributes', params={
11  'search': 'color',
12  'ordering': 'attribute__name',
13  'limit': 20
14}, headers={'Authorization': 'Token <your_api_key>'})
15print(response.json())

Status Codes

CodeDescription
200Attributes retrieved successfully
401Unauthorized — authentication required
403Forbidden — insufficient permissions
404Not found — product does not exist
500Internal server error

Response Fields

FieldTypeDescription
idIntegerUnique ID of the product attribute
attribute_dataObjectDetails of the attribute (id, name, description)
value_dataObjectDetails of the attribute value (id, value)
created_atString (ISO 8601)Timestamp when product attribute was created
updated_atString (ISO 8601)Timestamp when product attribute was last updated

Attribute Data Structure

FieldTypeDescription
idIntegerUnique ID of the attribute
nameStringAttribute name (max 150 characters)
descriptionStringAttribute description (max 500 characters)
created_atString (ISO 8601)Timestamp when attribute was created
updated_atString (ISO 8601)Timestamp when attribute was last updated

Value Data Structure

FieldTypeDescription
idIntegerUnique ID of the attribute value
valueStringThe value of the attribute
created_atString (ISO 8601)Timestamp when attribute value was created
updated_atString (ISO 8601)Timestamp when attribute value was last updated