Create Product
POST
‎https://<domain>/<api prefix>/<version>/commerce/product/create/
This API endpoint will create a product under an external-api-product type.
Request Body
Name Type Description Bundle id(bundle unique id)
bundle_name_translations*
Translations for a product bundle.
A Bundle name in English is required.
description_translations*
Product description,
Description in English is required.
short_description_translations*
Product short description,
A short description in English is required.
At least one varient is required.
Varient must contain price, product-name, and whole-sale-price. and ensure that the selected product type only contains these three varients.
Additionally, add a key product-sku (product unique sku).
The attribute must contain business-volume, points, and, cumulative-volume.
200
Copy ​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
"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.
Copy {
"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>}
}
Sample Code
Node
Copy 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
Copy <? 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;
Error Responses
Required product type for creating product using api is not created.
Bundle id is required.
This field may not be blank.
Produt with same bundle id is already exist.
This field is required.
This field may not be blank.
Ensure this field has no more than 200 characters.
This field is required.
Bundle Name for en language is required.
This field is required.
Description of en language is required.
short_description_translations
This field is required.
A short description of en language is required.
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.
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.
Update Product
POST
‎https://<domain>/<api prefix>/<version>/commerce/product/update/
This API endpoint will update a product bundle if it's an external-api-product type .
Request Body
Name Type Description New name or existing name for bundle.
bundle_name_translations*
Existing or New Translations for a product bundle.
description_translations*
Existing or New Translations for Product description
short_description_translations*
Existing or New Translations for Product short description,
Varient must contain price, product-name, and whole-sale-price. Additionally, add a key product-sku with aexisting sku as a value if u want to update existing variant or give new sku as a value to add new product varient.
The attribute must contain business-volume, points, and, cumulative-volume.
200
Copy ​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
"status_code": 200,
"errors": {},
"data": {}
}
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.
Copy {
"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>}
}
Sample Code
Node
Copy 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
Copy <? 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;
Error Responses
Bundle id is required.
This field may not be blank.
Bundle does not exist.
Requested bundle is not under the external api product category.
This field is required.
This field may not be blank.
Ensure this field has no more than 200 characters.
This field is required.
Description of en language is required.
short_description_translations
This field is required.
A short description of en language 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 sku should be a unique value. Product sku may not be a null value. Same product sku's recieved.
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 Product Bundle
DELETE
‎https://<domain>/<api prefix>/<version>/commerce/product/delete/
This API endpoint will delete a product bundle if it's an external-api-product type.
Query Parameters
200
Copy ​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
"status_code": 200,
"errors": {},
"data": {}
}
Sample Code
Node
Copy 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
Copy <? 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;
Error Responses
Bundle id is required.
This field may not be blank.
Product Bundle does not exist.
Product Bundle is not a external-api-product type.
The product contains in a order that is not completed yet.
The package purchased by some users.
Delete Product Varient
DELETE
‎https://<domain>/<api prefix>/<version>/commerce/product/delete/product-varient/
This API endpoint will delete a varient (product) from the product bundle if it's an external-api-product type.
Query Parameters
200
Copy ​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
"status_code": 200,
"errors": {},
"data": {}
}
Sample Code
Node
Copy 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
Copy <? 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;
Error Responses
This field is required.
This field may not be blank.
Product sku is not valid.
Product does not exist.
This field is required.
This field may not be blank.
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.
List Products
GET
‎https://<domain>/<api prefix>/<version>/commerce/product/list/
This API endpoint List product bundle with product details.
Query Parameters
200
Copy ​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
"status_code": 200,
"errors": {},
"data": {
"results": [
{
"name": "<bundli_name>",
"product_type": "<product_type>",
"status": <status>,
"products": [
{
"product_id": "<product_id>",
"name": "<product_name>",
"product_type": "<product_type_name>",
"base_price": "<product_price>",
"status": <status>,
"image": "<image>"
}
],
"bundle_id": "<bundle_id>"
},
...
],
"count": <list_count>,
"previous": <previous_page_url>,
"next": <next_page_url>
}
}
Sample Code
Node
Copy 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
Copy <? 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;
Create Bulk Products
POST
‎https://<domain>/<api prefix>/<version>/commerce/product/bulk/create/
This API endpoint will create bulk product.
200
Copy ​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
"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.>]
}
}
}
Body params :- JSON.stringify
Copy [
{
"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>}
} ,
...
]
Sample Code
Node
Copy 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
Copy <? 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;
Error Responses
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.
List API Product
GET
‎https://<domain>/<api prefix>/<version>/commerce/product/list/api-products/
This API endpoint will return a list of products that are created by api.
200
Copy ​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
"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>
}
}
Sample Code
Node
Copy 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
Copy <? 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;