Skip to main content

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.

Request Schema (application/json)
Field NameField TypeRequired
attribute_namestringYes
attribute_codestringYes
is_requiredinteger or string (0, 1, '0', '1')Yes
display_on_frontendinteger or string (0, 1, '0', '1')Yes
sort_orderstring or integerNo
is_filterableinteger or string (0, 1, '0', '1')No
groupsarray of string,integerYes
optionsarray of objectNo
Field NameField TypeRequired
option_textstringYes
option_idstring or integerNo
POST/api/attributes
curl
-H "Accept: application/json"
-H "Cookie: asid=<your admin cookie>"
https://<your domain>/api/attributes
Sample Of Response
{
"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.

Request Schema (application/json)
Field NameField TypeRequired
attribute_namestringNo
attribute_codestringYes
is_requiredinteger or string (0, 1, '0', '1')No
display_on_frontendinteger or string (0, 1, '0', '1')No
sort_orderstring or integerNo
is_filterableinteger or string (0, 1, '0', '1')No
groupsarray of string,integerNo
optionsarray of objectNo
Field NameField TypeRequired
option_textstringYes
option_idstring or integerNo
PATCH/api/attributes/363ba97f-8be7-4be9-be3f-a9f341f2b89f
curl
-H "Accept: application/json"
-H "Cookie: asid=<your admin cookie>"
https://<your domain>/api/attributes/363ba97f-8be7-4be9-be3f-a9f341f2b89f
Sample Of Response
{
"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.

Request Schema (application/json)
No request body required
DELETE/api/attributes/363ba97f-8be7-4be9-be3f-a9f341f2b89f
curl
-H "Accept: application/json"
-H "Cookie: asid=<your admin cookie>"
https://<your domain>/api/attributes/363ba97f-8be7-4be9-be3f-a9f341f2b89f
Sample Of Response
{
"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.

Request Schema (application/json)
No request body required
GET/api/attributes/363ba97f-8be7-4be9-be3f-a9f341f2b89f
curl
-H "Accept: application/json"
-H "Cookie: asid=<your admin cookie>"
https://<your domain>/api/attributes/363ba97f-8be7-4be9-be3f-a9f341f2b89f
Sample Of Response
{
"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.

Request Schema (application/json)
No request body required
GET/api/attributes
curl
-H "Accept: application/json"
-H "Cookie: asid=<your admin cookie>"
https://<your domain>/api/attributes
Sample Of Response
{
"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 CodeDescription
400Bad Request - Invalid parameters
401Unauthorized - Authentication required
403Forbidden - Insufficient permissions
404Not Found - Attribute doesn't exist
500Server Error - Something went wrong

Error responses follow this format:

{
"error": {
"status": 404,
"message": "Attribute not found"
}
}

Best Practices

  1. Naming Convention: Use clear, descriptive names for attributes and consistent codes (e.g., color, size, material)
  2. Attribute Types: Choose the appropriate attribute type (text, select, multiselect, etc.) based on how the data will be used
  3. Group Organization: Assign attributes to logical groups to keep your product editing interface organized
  4. Filterable Attributes: Mark attributes as filterable only when they're useful for customers to filter products by (e.g., color, size, price range)