Product
Manage Product
post
https://<domain>/<api prefix>/<version>/commerce/product/create/
Note:-
By using this API endpoint you can create a product under product type external-api-product.
Body Parameters are JSON.stringify, Refer below block for the body parameter structure, and also refer sample code.
{
"bundle_id":"<bundle_id>",
"name":"<bundle_name>",
"bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
"description_translations":{"en": "<description_en>","de": "<description_dn>"},
"short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
"varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"}],
"attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
}
Node
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://<domain>/<api prefix>/<version>/commerce/product/create/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"bundle_id":"<bundle_id>",
"name":"<bundle_name>",
"bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
"description_translations":{"en": "<description_en>","de": "<description_dn>"},
"short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
"varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"}],
"attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/commerce/product/create/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"bundle_id":"<bundle_id>",
"name":"<bundle_name>",
"bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
"description_translations":{"en": "<description_en>","de": "<description_dn>"},
"short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
"varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"}],
"attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
}',
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access token>',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Status Code | Error Type | FIeld | Description |
401 | Request Failed | | Required product type for creating product using api is not created. |
400 | Validation Error | bundle_id | Bundle id is required. This field may not be blank. Produt with same bundle id is already exist. |
400 | Validation Error | name | This field is required. This field may not be blank. Ensure this field has no more than 200 characters. |
400 | Validation Error | bundle_name_translations | This field is required. Bundle Name for en language is required. |
400 | Validation Error | description_translations | This field is required. Description of en language is required. |
400 | Validation Error | short_description_translations | This field is required. A short description of en language is required. |
400 | Validation Error | varients | This field is required. You can't possible add a product under the requested product type. Select a product type have only Price, Whole sale price and Product name as varients. One of the varient object is not valid, check each varient objects contains price,product-name,whole-sale-price and product-sku. At least one varient is required. Product id should be a unique value. Product id may not be a null value. Same product id's recieved. |
400 | Validation Error | attributes | This field is required. You cant possible to add product under the requested product type. Select a product type have only Business-volume, Pointes and Cumulative-volume as attributes. Attribute should contains Business-volume, Points and Cumulative-volume, not include another attributes. Business-volume is required. Points is required. Cumulative-volume is required. Attribute must contains Business-volume, Points and Cumulative-volume. |
post
https://<domain>/<api prefix>/<version>/commerce/product/update/
Note:-
By using this API endpoint you can update a product that is under external-api-product.
Additionally, add a key product-sku with a existing id as a value if you want to update the existing varient. Give new id as a value of product-sku for adding a new product varient.
Body Parameters are JSON.stringify, Refer below block for the body parameter structure, and also refer sample code.
{
"bundle_id":"<bundle_id>",
"name":"<bundle_name>",
"bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
"description_translations":{"en": "<description_en>","de": "<description_dn>"},
"short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
"varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":<product_sku>},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":<product_sku>}],
"attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
}
Node
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://<domain>/<api prefix>/<version>/commerce/product/update/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"bundle_id":"<bundle_id>",
"name":"<bundle_name>",
"bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
"description_translations":{"en": "<description_en>","de": "<description_dn>"},
"short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
"varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":<product_sku>},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":<product_sku>}],
"attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/commerce/product/update/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"bundle_id":"<bundle_id>",
"name":"<bundle_name>",
"bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
"description_translations":{"en": "<description_en>","de": "<description_dn>"},
"short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
"varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":<product_sku>},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":<product_sku>}],
"attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
}',
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access token>',
'Content-Type: application/json',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Status Code | Error Type | FIeld | Description |
400 | Invalid Input | bundle_id | Bundle id is required. This field may not be blank. Bundle does not exist. Requested bundle is not under the external api product category. |
400 | Validation Error | name | This field is required. This field may not be blank. Ensure this field has no more than 200 characters. |
400 | Validation Error | description_translations | This field is required. Description of en language is required. |
400 | Validation Error | short_description_translations | This field is required. A short description of en language is required. |
400 | Validation Error | varients | You can't possible add a product under the requested product type. Select a product type have only Price, Whole sale price and Product name as varients. One of the varient object is not valid, check each varient objects contains price,product-name,whole-sale-price and product-sku. At least one varient is required. Product sku should be a unique value. Product sku may not be a null value. Same product sku's recieved. |
400 | Validation Error | attributes | You cant possible to add product under the requested product type. Select a product type have only Business-volume, Pointes and Cumulative-volume as attributes. Attribute should contains Business-volume, Points and Cumulative-volume, not include another attributes. Business-volume is required. Points is required. Cumulative-volume is required. Attribute must contains Business-volume, Points and Cumulative-volume. |
delete
https://<domain>/<api prefix>/<version>/commerce/product/delete/
Node
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://<domain>/<api prefix>/<version>/commerce/product/delete/?bundle_id=<bundle_id>',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/commerce/product/delete/?bundle_id=<bundle_id>',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access token>'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Status Code | Error Type | FIeld | Description |
400 | Invalid Input | bundle_id | Bundle id is required. This field may not be blank. Product Bundle does not exist. Product Bundle is not a external-api-product type. |
401 | Request Failed | | The product contains in a order that is not completed yet. The package purchased by some users. |
delete
https://<domain>/<api prefix>/<version>/commerce/product/delete/product-varient/
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://<domain>/<api prefix>/<version>/commerce/product/delete/product-varient/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/commerce/product/delete/product-varient/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access token>',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Status Code | Error Type | FIeld | Description |
400 | Validation Error | product_sku | This field is required. This field may not be blank. Product sku is not valid. Product does not exist. |
400 | Validation Error | bundle_id | This field is required. This field may not be blank. |
401 | Request Failed | | Only one varient left under the product bundle, can't delete it. You can delete a product under the external-api-product not athor category product. Only one varient left under the prouct bundle, can't delete it. |
get
https://<domain>/<api prefix>/<version>/commerce/product/list/
Node
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://<domain>/<api prefix>/<version>/commerce/product/list/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/commerce/product/list/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access token>'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
post
https://<domain>/<api prefix>/<version>/commerce/product/bulk/create/
[
{
"bundle_id":"<bundle_id>",
"name":"<bundle_name>",
"bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
"description_translations":{"en": "<description_en>","de": "<description_dn>"},
"short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
"varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sk>"}],
"attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
},
{
"bundle_id":"<bundle_id>",
"name":"<bundle_name>",
"bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
"description_translations":{"en": "<description_en>","de": "<description_dn>"},
"short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
"varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sju>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"}],
"attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
},
...
]
Node
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://<domain>/<api prefix>/<version>/commerce/product/bulk/create/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>',
'Content-Type': 'application/json',
},
body: JSON.stringify([{
"bundle_id":"<bundle_id>",
"name":"<bundle_name>",
"bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
"description_translations":{"en": "<description_en>","de": "<description_dn>"},
"short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
"varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"}],
"attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
},
{
"bundle_id":"<bundle_id>",
"name":"<bundle_name>",
"bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
"description_translations":{"en": "<description_en>","de": "<description_dn>"},
"short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
"varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"}],
"attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
},
...
])
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/commerce/product/bulk/create/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'[
{
"bundle_id":"<bundle_id>",
"name":"<bundle_name>",
"bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
"description_translations":{"en": "<description_en>","de": "<description_dn>"},
"short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
"varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"}],
"attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
},
{
"bundle_id":"<bundle_id>",
"name":"<bundle_name>",
"bundle_name_translations":{"en": "<bundle_name_en>","de": "<bundle_name_de>"},
"description_translations":{"en": "<description_en>","de": "<description_dn>"},
"short_description_translations":{"en": "<short_description_en>","de": "<short_description_de>"},
"varients":[{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-sku":"<product_sku>"}],
"attributes":{"business-volume":<business-volume>, "points":<reward_point>, "cumulative-volume":<cumulative_volume>}
},
...
]',
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access token>',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Status Code | Error Type | FIeld | Description |
400 | Request Failed | | Required product type for creating product using api is not created. Maximum bulk create product count is 50. |
Check error responses of the create product endpoint.
get
https://<domain>/<api prefix>/<version>/commerce/product/list/api-products/
Node
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://<domain>/<api prefix>/<version>/commerce/product/list/api-products/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>',
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/commerce/product/list/api-products/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access token>',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Last modified 1yr ago