Attribute API
Overview
The Attribute API provides endpoints for managing product attributes in your EverShop store. Product attributes define specific characteristics of products, such as color, size, material, or any custom properties you need for your catalog.
Endpoints
Create an Attribute
Creates a new product attribute in the system. Attributes can be assigned to attribute groups and may include multiple options depending on the attribute type.
Field Name | Field Type | Required | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
attribute_name | string | Yes | |||||||||
attribute_code | string | Yes | |||||||||
is_required | integer or string (0, 1, '0', '1') | Yes | |||||||||
display_on_frontend | integer or string (0, 1, '0', '1') | Yes | |||||||||
sort_order | string or integer | No | |||||||||
is_filterable | integer or string (0, 1, '0', '1') | No | |||||||||
groups | array of string,integer | Yes | |||||||||
options | array of object | No | |||||||||
|
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Cookie: asid=<your admin cookie>"
https://<your domain>/api/attributes
fetch('https://<your domain>/api/attributes', {
headers: {
'Accept': 'application/json',
'Cookie': 'asid=<your admin cookie>'
}
})
.then(response => response.json())
.then(data => {
if(data.error) {
// Handle the error
} else {
// Handle the data
}
})
.catch(error => {
// Handle the error
});
{
"data": {
"attribute_id": 99,
"uuid": "98bd0beea63211edb46b60d819134f39",
"attribute_code": "GTW5s9bqJ7rP3gDrU5HF",
"attribute_name": "Text attribute",
"type": "text",
"is_required": 1,
"display_on_frontend": 1,
"sort_order": 1,
"is_filterable": 0,
"links": [
{
"rel": "attributeGrid",
"href": "/admin/attributes",
"action": "GET",
"types": [
"text/xml"
]
},
{
"rel": "edit",
"href": "/admin/attributes/edit/98bd0beea63211edb46b60d819134f39",
"action": "GET",
"types": [
"text/xml"
]
}
]
}
}
Update an Attribute
Modifies an existing product attribute. You can update the attribute name, settings, associated groups, and options.
Field Name | Field Type | Required | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
attribute_name | string | No | |||||||||
attribute_code | string | Yes | |||||||||
is_required | integer or string (0, 1, '0', '1') | No | |||||||||
display_on_frontend | integer or string (0, 1, '0', '1') | No | |||||||||
sort_order | string or integer | No | |||||||||
is_filterable | integer or string (0, 1, '0', '1') | No | |||||||||
groups | array of string,integer | No | |||||||||
options | array of object | No | |||||||||
|
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Cookie: asid=<your admin cookie>"
https://<your domain>/api/attributes/363ba97f-8be7-4be9-be3f-a9f341f2b89f
fetch('https://<your domain>/api/attributes/363ba97f-8be7-4be9-be3f-a9f341f2b89f', {
headers: {
'Accept': 'application/json',
'Cookie': 'asid=<your admin cookie>'
}
})
.then(response => response.json())
.then(data => {
if(data.error) {
// Handle the error
} else {
// Handle the data
}
})
.catch(error => {
// Handle the error
});
{
"data": {
"attribute_id": 99,
"uuid": "363ba97f-8be7-4be9-be3f-a9f341f2b89f",
"attribute_code": "GTW5s9bqJ7rP3gDrU5HF",
"attribute_name": "Text attribute",
"type": "text",
"is_required": 1,
"display_on_frontend": 1,
"sort_order": 1,
"is_filterable": 0,
"links": [
{
"rel": "attributeGrid",
"href": "/admin/attributes",
"action": "GET",
"types": [
"text/xml"
]
},
{
"rel": "edit",
"href": "/admin/attributes/edit/363ba97f-8be7-4be9-be3f-a9f341f2b89f",
"action": "GET",
"types": [
"text/xml"
]
}
]
}
}
Delete an Attribute
Permanently removes a product attribute from the system. Note that this will also remove all associations of this attribute with products.
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Cookie: asid=<your admin cookie>"
https://<your domain>/api/attributes/363ba97f-8be7-4be9-be3f-a9f341f2b89f
fetch('https://<your domain>/api/attributes/363ba97f-8be7-4be9-be3f-a9f341f2b89f', {
headers: {
'Accept': 'application/json',
'Cookie': 'asid=<your admin cookie>'
}
})
.then(response => response.json())
.then(data => {
if(data.error) {
// Handle the error
} else {
// Handle the data
}
})
.catch(error => {
// Handle the error
});
{
"data": {
"attribute_id": 99,
"uuid": "363ba97f-8be7-4be9-be3f-a9f341f2b89f",
"attribute_code": "GTW5s9bqJ7rP3gDrU5HF",
"attribute_name": "Text attribute Updated",
"type": "text",
"is_required": 1,
"display_on_frontend": 1,
"sort_order": 1,
"is_filterable": 0
}
}
Get an Attribute
Retrieves detailed information about a specific product attribute.
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Cookie: asid=<your admin cookie>"
https://<your domain>/api/attributes/363ba97f-8be7-4be9-be3f-a9f341f2b89f
fetch('https://<your domain>/api/attributes/363ba97f-8be7-4be9-be3f-a9f341f2b89f', {
headers: {
'Accept': 'application/json',
'Cookie': 'asid=<your admin cookie>'
}
})
.then(response => response.json())
.then(data => {
if(data.error) {
// Handle the error
} else {
// Handle the data
}
})
.catch(error => {
// Handle the error
});
{
"data": {
"attribute_id": 99,
"uuid": "363ba97f-8be7-4be9-be3f-a9f341f2b89f",
"attribute_code": "GTW5s9bqJ7rP3gDrU5HF",
"attribute_name": "Text attribute",
"type": "text",
"is_required": 1,
"display_on_frontend": 1,
"sort_order": 1,
"is_filterable": 0,
"options": []
}
}
List All Attributes
Retrieves a paginated list of all product attributes in the system.
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Cookie: asid=<your admin cookie>"
https://<your domain>/api/attributes
fetch('https://<your domain>/api/attributes', {
headers: {
'Accept': 'application/json',
'Cookie': 'asid=<your admin cookie>'
}
})
.then(response => response.json())
.then(data => {
if(data.error) {
// Handle the error
} else {
// Handle the data
}
})
.catch(error => {
// Handle the error
});
{
"data": [
{
"attribute_id": 99,
"uuid": "363ba97f-8be7-4be9-be3f-a9f341f2b89f",
"attribute_code": "color",
"attribute_name": "Color",
"type": "select",
"is_required": 0,
"display_on_frontend": 1,
"sort_order": 10,
"is_filterable": 1,
"options": [
{
"option_id": 1,
"option_text": "Red"
},
{
"option_id": 2,
"option_text": "Blue"
},
{
"option_id": 3,
"option_text": "Green"
}
]
},
{
"attribute_id": 100,
"uuid": "363ba97f-8be7-4be9-be3f-a9f341f2b89e",
"attribute_code": "size",
"attribute_name": "Size",
"type": "select",
"is_required": 0,
"display_on_frontend": 1,
"sort_order": 20,
"is_filterable": 1,
"options": [
{
"option_id": 4,
"option_text": "Small"
},
{
"option_id": 5,
"option_text": "Medium"
},
{
"option_id": 6,
"option_text": "Large"
}
]
}
],
"links": {
"first": "/api/attributes?page=1",
"last": "/api/attributes?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"path": "/api/attributes",
"per_page": 20,
"to": 2,
"total": 2
}
}
Error Handling
All endpoints may return the following error responses:
Status Code | Description |
---|---|
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Authentication required |
403 | Forbidden - Insufficient permissions |
404 | Not Found - Attribute doesn't exist |
500 | Server Error - Something went wrong |
Error responses follow this format:
{
"error": {
"status": 404,
"message": "Attribute not found"
}
}
Best Practices
- Naming Convention: Use clear, descriptive names for attributes and consistent codes (e.g.,
color
,size
,material
) - Attribute Types: Choose the appropriate attribute type (text, select, multiselect, etc.) based on how the data will be used
- Group Organization: Assign attributes to logical groups to keep your product editing interface organized
- Filterable Attributes: Mark attributes as filterable only when they're useful for customers to filter products by (e.g., color, size, price range)