Skip to main content
⭐️ If you love EverShop, give it a star on GitHub. Thanks!

Attribute API

Use the REST API to interact with EverShop product attribute.

Create an attribute

Use this endpoint to create an attribute.

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

Use this endpoint to update an attribute.

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/{id}
curl
-H "Accept: application/json"
-H "Cookie: asid=<your admin cookie>"
https://<your domain>/api/attributes/{id}
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"
]
}
]
}
}

Delete an attribute

Use this endpoint to delete an attribute.

Request Schema (application/json)
No request body required
DELETE/api/attributes/{id}
curl
-H "Accept: application/json"
-H "Cookie: asid=<your admin cookie>"
https://<your domain>/api/attributes/{id}
Sample Of Response
{
"data": {
"attribute_id": 99,
"uuid": "98bd0beea63211edb46b60d819134f39",
"attribute_code": "GTW5s9bqJ7rP3gDrU5HF",
"attribute_name": "Text attribute Updated",
"type": "text",
"is_required": 1,
"display_on_frontend": 1,
"sort_order": 1,
"is_filterable": 0
}
}