Product API
The Product API allows you to programmatically manage products in your EverShop store. This RESTful interface provides endpoints for creating, updating, retrieving, and deleting products.
Endpoints
Create a Product
Creates a new product in your EverShop store with the specified attributes.
Request Schema (application/json)
| Field Name | Field Type | Required | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| name | string | No | ||||||||||||||||||||||||||||||
| description | array of object | No | ||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||
| short_description | string | No | ||||||||||||||||||||||||||||||
| url_key | string (^\S+$) | No | ||||||||||||||||||||||||||||||
| meta_title | string | No | ||||||||||||||||||||||||||||||
| meta_description | string | No | ||||||||||||||||||||||||||||||
| meta_keywords | string | No | ||||||||||||||||||||||||||||||
| status | integer or string or boolean (0, 1, '0', '1', true, false) | No | ||||||||||||||||||||||||||||||
| sku | string | No | ||||||||||||||||||||||||||||||
| price | string or number | No | ||||||||||||||||||||||||||||||
| weight | string or number | No | ||||||||||||||||||||||||||||||
| qty | string or number | No | ||||||||||||||||||||||||||||||
| tax_class | string or number or null | No | ||||||||||||||||||||||||||||||
| manage_stock | integer or string or boolean (0, 1, '0', '1', true, false) | No | ||||||||||||||||||||||||||||||
| stock_availability | integer or string or boolean (0, 1, '0', '1', true, false) | No | ||||||||||||||||||||||||||||||
| group_id | string or integer | No | ||||||||||||||||||||||||||||||
| visibility | integer or string or boolean (0, 1, '0', '1', true, false) | No | ||||||||||||||||||||||||||||||
| images | array of string | No | ||||||||||||||||||||||||||||||
| attributes | array of object | No | ||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||
| category_id | string or number or null | No | ||||||||||||||||||||||||||||||
| options | array of object | No | ||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||
POST/api/products
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Authorization: Bearer <admin JWT token>"
--data-raw '<JSON DATA>'
https://<your domain>/api/products
fetch('https://<your domain>/api/products', {
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer <admin JWT token>'
},
body: <JSON DATA>
})
.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": {
"product_id": 281,
"uuid": "99a7b39ca63211edb46b60d819134f39",
"variant_group_id": null,
"visibility": 1,
"group_id": 4,
"image": null,
"sku": "Q7Oq0kxZIMQ5isUyJRbg",
"price": 43,
"qty": 123,
"weight": 17,
"manage_stock": 1,
"stock_availability": 1,
"tax_class": null,
"status": 0,
"created_at": "2023-02-07 00:01:46",
"updated_at": "2023-02-07 00:01:46",
"product_description_id": 351,
"product_description_product_id": 281,
"name": "Q7Oq0kxZIMQ5isUyJRbg",
"description": null,
"short_description": null,
"url_key": "Q7Oq0kxZIMQ5isUyJRbg",
"meta_title": "Q7Oq0kxZIMQ5isUyJRbg",
"meta_description": null,
"meta_keywords": null,
"links": [
{
"rel": "productGrid",
"href": "/admin/products",
"action": "GET",
"types": [
"text/xml"
]
},
{
"rel": "view",
"href": "/product/Q7Oq0kxZIMQ5isUyJRbg",
"action": "GET",
"types": [
"text/xml"
]
},
{
"rel": "edit",
"href": "/admin/products/edit/99a7b39ca63211edb46b60d819134f39",
"action": "GET",
"types": [
"text/xml"
]
}
]
}
}
Update a Product
Updates an existing product with new attribute values.
Request Schema (application/json)
| Field Name | Field Type | Required | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| name | string | No | ||||||||||||||||||||||||||||||
| description | array of object | No | ||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||
| short_description | string | No | ||||||||||||||||||||||||||||||
| url_key | string (^\S+$) | No | ||||||||||||||||||||||||||||||
| meta_title | string | No | ||||||||||||||||||||||||||||||
| meta_description | string | No | ||||||||||||||||||||||||||||||
| meta_keywords | string | No | ||||||||||||||||||||||||||||||
| status | integer or string or boolean (0, 1, '0', '1', true, false) | No | ||||||||||||||||||||||||||||||
| sku | string | No | ||||||||||||||||||||||||||||||
| price | string or number | No | ||||||||||||||||||||||||||||||
| weight | string or number | No | ||||||||||||||||||||||||||||||
| qty | string or number | No | ||||||||||||||||||||||||||||||
| tax_class | string or number or null | No | ||||||||||||||||||||||||||||||
| manage_stock | integer or string or boolean (0, 1, '0', '1', true, false) | No | ||||||||||||||||||||||||||||||
| stock_availability | integer or string or boolean (0, 1, '0', '1', true, false) | No | ||||||||||||||||||||||||||||||
| group_id | string or integer | No | ||||||||||||||||||||||||||||||
| visibility | integer or string or boolean (0, 1, '0', '1', true, false) | No | ||||||||||||||||||||||||||||||
| images | array of string | No | ||||||||||||||||||||||||||||||
| attributes | array of object | No | ||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||
| category_id | string or number or null | No | ||||||||||||||||||||||||||||||
| options | array of object | No | ||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||
PATCH/api/products/433ba97f-8be7-4be9-be3f-a9f341f2b89f
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Authorization: Bearer <admin JWT token>"
--data-raw '<JSON DATA>'
https://<your domain>/api/products/433ba97f-8be7-4be9-be3f-a9f341f2b89f
fetch('https://<your domain>/api/products/433ba97f-8be7-4be9-be3f-a9f341f2b89f', {
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer <admin JWT token>'
},
body: <JSON DATA>
})
.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": {
"product_id": 281,
"uuid": "433ba97f-8be7-4be9-be3f-a9f341f2b89f",
"variant_group_id": null,
"visibility": 1,
"group_id": 4,
"image": null,
"sku": "Q7Oq0kxZIMQ5isUyJRbg",
"price": 43,
"qty": 123,
"weight": 17,
"manage_stock": 1,
"stock_availability": 1,
"tax_class": null,
"status": 0,
"created_at": "2023-02-07 00:01:46",
"updated_at": "2023-02-07 00:01:46",
"product_description_id": 351,
"product_description_product_id": 281,
"name": "Q7Oq0kxZIMQ5isUyJRbg",
"description": null,
"short_description": null,
"url_key": "Q7Oq0kxZIMQ5isUyJRbg",
"meta_title": "Q7Oq0kxZIMQ5isUyJRbg",
"meta_description": null,
"meta_keywords": null,
"links": [
{
"rel": "productGrid",
"href": "/admin/products",
"action": "GET",
"types": [
"text/xml"
]
},
{
"rel": "view",
"href": "/product/Q7Oq0kxZIMQ5isUyJRbg",
"action": "GET",
"types": [
"text/xml"
]
},
{
"rel": "edit",
"href": "/admin/products/edit/99a7b39ca63211edb46b60d819134f39",
"action": "GET",
"types": [
"text/xml"
]
}
]
}
}
Path Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| id | string | The UUID of the product to update | Yes |
Update Parameters
All parameters are optional for updates. Only include the parameters you want to modify. See the Create a Product section for detailed parameter descriptions.
Delete a Product
Removes a product from your EverShop store.
Request Schema (application/json)
No request body requiredDELETE/api/products/433ba97f-8be7-4be9-be3f-a9f341f2b89f
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Authorization: Bearer <admin JWT token>"
https://<your domain>/api/products/433ba97f-8be7-4be9-be3f-a9f341f2b89f
fetch('https://<your domain>/api/products/433ba97f-8be7-4be9-be3f-a9f341f2b89f', {
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer <admin JWT token>'
}
})
.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": {
"product_id": 281,
"uuid": "433ba97f-8be7-4be9-be3f-a9f341f2b89f",
"variant_group_id": null,
"visibility": 1,
"group_id": 4,
"image": null,
"sku": "skuUpdated",
"price": 45,
"qty": 123,
"weight": 17,
"manage_stock": 1,
"stock_availability": 1,
"tax_class": null,
"status": 1,
"created_at": "2023-02-07 00:01:46",
"updated_at": "2023-02-07 00:01:46",
"product_description_id": null,
"product_description_product_id": null,
"name": null,
"description": null,
"short_description": null,
"url_key": null,
"meta_title": null,
"meta_description": null,
"meta_keywords": null
}
}
Path Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| id | string | The UUID of the product to delete | Yes |
Get Product Data with GraphQL
EverShop uses GraphQL for querying product data. For detailed information on how to query products, refer to the GraphQL API documentation.