HTTP/1.1 200 OKContent-Type: application/jsonBody:{"status_code": 200,"errors": {},"data": {}}
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-id":"<product_id>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-id":"<product_id>"}],"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-id":"<product_id>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-id":"<product_id>"}],"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-id":"<product_id>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-id":"<product_id>"}],"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-id. 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. |
HTTP/1.1 200 OKContent-Type: application/jsonBody:{"status_code": 200,"errors": {},"data": {}}
Note:-
By using this API endpoint you can update a product which is under external-api-product.
Additionally, add a key product-id with a existing id as a value if you want to update the existing varient. Give new id as a value of product-id 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-id":<product_id>},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-id":<product_id>}],"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-id":<product_id>},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-id":<product_id>}],"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-id":<product_id>},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-id":<product_id>}],"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-id. 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 | 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. |
HTTP/1.1 200 OKContent-Type: application/jsonBody:{"status_code": 200,"errors": {},"data": {}}
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. |
HTTP/1.1 200 OKContent-Type: application/jsonBody:{"status_code": 200,"errors": {},"data": {}}
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_id | This field is required. This field may not be blank. Product id 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. |
HTTP/1.1 200 OKContent-Type: application/jsonBody:{"status_code": 200,"errors": {},"data": {"results": [{"id": <product_id>,"title": "<product_name>","sku": "<product_sku>","product_type": {"id": <product_type_id>,"name": "<product_type_name>","slug": "<produt_type_slug>"},"bundle_id": {"id": <bundli_id>,"name": "<bundli_name>","slug": "<bundle_slug>"},"status": <product_active_status>,"created": "<created_date>","base_price": "<product_price>"}...],"count": <list_count>,"previous": <previous_page_url>,"next": <next_page_url>}}
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;
HTTP/1.1 200 OKContent-Type: application/jsonBody:{"status_code": 200,"errors": {},"data": {"Product_creation_failed": {"same_bundle_id": [<return if already exist product with same bundle id.>],"bundle_id_null": [<return if bunle is a null value.>],"bundle_id_not_found": [<return if bundle id is not given.>]}}}
[{"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-id":"<product_id>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-id":"<product_id>"}],"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-id":"<product_id>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-id":"<product_id>"}],"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-id":"<product_id>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-id":"<product_id>"}],"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-id":"<product_id>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-id":"<product_id>"}],"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-id":"<product_id>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-id":"<product_id>"}],"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-id":"<product_id>"},{"price":<product_price>,"product-name":"<product_name>","whole-sale-price":<whole_sale_price>,"product-id":"<product_id>"}],"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.
HTTP/1.1 200 OKContent-Type: application/jsonBody:{"status_code": 200,"errors": {},"data": {"results": [{"bundle_id": "<bundle_id>","bundle_name": "<bundle_name>","products": [{"product_id": "<product_id>","name": "<product_name1>","base_price": <base_price>,"status": <status>},...]},...],"count": <list_count>,"previous": <previous_page_url>,"next": <next_page_url>}}
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;