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 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 | |||||||||
|
POST/api/attributes
- cURL
- JavaScript
curl -H "Accept: application/json" -H "Cookie: admin_token=<your jwt token id>" https://<your domain>/api/attributes
fetch('https://<your domain>/api/attributes', { headers: { 'Accept': 'application/json', 'Cookie': 'admin_token=<your jwt token id>' }}) .then(response => response.json()) .then(data => { if(data.error) { // Handle the error } else { // Handle the data } }) .catch(error => { // Handle the error });
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 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 | |||||||||
|
PATCH/api/attributes/{id}
- cURL
- JavaScript
curl -H "Accept: application/json" -H "Cookie: admin_token=<your jwt token id>" https://<your domain>/api/attributes/{id}
fetch('https://<your domain>/api/attributes/{id}', { headers: { 'Accept': 'application/json', 'Cookie': 'admin_token=<your jwt token id>' }}) .then(response => response.json()) .then(data => { if(data.error) { // Handle the error } else { // Handle the data } }) .catch(error => { // Handle the error });
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 requiredDELETE/api/attributes/{id}
- cURL
- JavaScript
curl -H "Accept: application/json" -H "Cookie: admin_token=<your jwt token id>" https://<your domain>/api/attributes/{id}
fetch('https://<your domain>/api/attributes/{id}', { headers: { 'Accept': 'application/json', 'Cookie': 'admin_token=<your jwt token id>' }}) .then(response => response.json()) .then(data => { if(data.error) { // Handle the error } else { // Handle the data } }) .catch(error => { // Handle the error });
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 }}