Products API
Use the REST API to interact with EverShop products.
Create a product
Use this endpoint to create a product.
Request Schema (application/json)
Field Name | Field Type | Required | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name | string | Yes | |||||||||||||||||||||||||||
description | string | No | |||||||||||||||||||||||||||
short_description | string | No | |||||||||||||||||||||||||||
url_key | string (^\S+$) | Yes | |||||||||||||||||||||||||||
meta_title | string | Yes | |||||||||||||||||||||||||||
meta_description | string | No | |||||||||||||||||||||||||||
meta_keywords | string | No | |||||||||||||||||||||||||||
status | integer or string (0, 1, '0', '1') | Yes | |||||||||||||||||||||||||||
sku | string | Yes | |||||||||||||||||||||||||||
price | string or number | Yes | |||||||||||||||||||||||||||
weight | string or number | Yes | |||||||||||||||||||||||||||
qty | string or number | Yes | |||||||||||||||||||||||||||
manage_stock | string or number (0, 1, '0', '1') | No | |||||||||||||||||||||||||||
stock_availability | string or number (0, 1, '0', '1') | No | |||||||||||||||||||||||||||
group_id | string or integer | Yes | |||||||||||||||||||||||||||
visibility | integer or string (0, 1, '0', '1') | Yes | |||||||||||||||||||||||||||
images | array of string | No | |||||||||||||||||||||||||||
attributes | array of object | No | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
categories | array of string,integer | No | |||||||||||||||||||||||||||
options | array of object | No | |||||||||||||||||||||||||||
|
POST/api/products
- cURL
- JavaScript
curl -H "Accept: application/json" -H "Cookie: admin_token=<your jwt token id>" https://<your domain>/api/products
fetch('https://<your domain>/api/products', { 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": { "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
Use this endpoint to update a product.
Request Schema (application/json)
Field Name | Field Type | Required | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name | string | No | |||||||||||||||||||||||||||||||||
description | string | 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 (0, 1, '0', '1') | No | |||||||||||||||||||||||||||||||||
sku | string | No | |||||||||||||||||||||||||||||||||
price | string or number | No | |||||||||||||||||||||||||||||||||
weight | string or number | No | |||||||||||||||||||||||||||||||||
qty | string or number | No | |||||||||||||||||||||||||||||||||
manage_stock | string or number (0, 1, '0', '1') | No | |||||||||||||||||||||||||||||||||
stock_availability | string or number (0, 1, '0', '1') | No | |||||||||||||||||||||||||||||||||
group_id | string or integer | No | |||||||||||||||||||||||||||||||||
visibility | integer or string (0, 1, '0', '1') | No | |||||||||||||||||||||||||||||||||
images | array of string | No | |||||||||||||||||||||||||||||||||
attributes | array of object | No | |||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
categories | array of string,integer | No | |||||||||||||||||||||||||||||||||
options | array of object | No | |||||||||||||||||||||||||||||||||
|
PATCH/api/products/{id}
- cURL
- JavaScript
curl -H "Accept: application/json" -H "Cookie: admin_token=<your jwt token id>" https://<your domain>/api/products/{id}
fetch('https://<your domain>/api/products/{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": { "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" ] } ] }}
Delete a product
Use this endpoint to delete a product.
Request Schema (application/json)
No request body requiredDELETE/api/products/{id}
- cURL
- JavaScript
curl -H "Accept: application/json" -H "Cookie: admin_token=<your jwt token id>" https://<your domain>/api/products/{id}
fetch('https://<your domain>/api/products/{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": { "product_id": 281, "uuid": "99a7b39ca63211edb46b60d819134f39", "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 }}