Product Catalogue

Manage product catalogue

List catalogues

get
https://<domain>/<api prefix>/<version>/commerce/product/list/catalogue/

Sample Code

Node
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://<domain>/<api prefix>/<version>/commerce/product/list/catalogue/',
'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/catalogue/",
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 Catalogue

post
https://<domain>/<api prefix>/<version>/commerce/product/create/catalogue/

Sample Code

Node
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://<domain>/<api prefix>/<version>/commerce/product/create/catalogue/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>',
},
formData: {
'name ': '<catalogue_name>',
'parent_id': '<parent_id>'
}
};
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/catalogue/",
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 => array('name ' => '<catalogue_name>','parent_id' => '<parent_name>'),
CURLOPT_HTTPHEADER => array(
"apikey: <apikey>",
"Authorization: Bearer <access token>",
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

Error Responses

Status Code
Error Type
Field
Description
400
Validation Error
name
This field is required.
This field may not be blank.
Ensure this field has no more than 200 characters.
"\"Catalogue name already selected. Please choose different name !"
400
Validation Error
parent_id
Parent id is required
This field may not be blank
Incorrect type. Expected pk value, received str.
Invalid pk \"parent_id\" - object does not exist.

Update Catalogue

post
https://<domain>/<api prefix>/<version>/commerce/product/update/catalogue/

Sample Code

Node
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://<domain>/<api prefix>/<version>/commerce/product/update/catalogue/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>',
},
formData: {
'id': '<catalogue_id>',
'name': '<name>',
'parent_id': '<parent_catalogue_id>'
}
};
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/catalogue/",
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 => array('id' => '<catalogue_id>','name' => '<name>','parent_id' => '<parent_catalogue_id>'),
CURLOPT_HTTPHEADER => array(
"apikey: <apikey>",
"Authorization: Bearer <access token>",
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

Error Responses

Status Code
Error Type
Field
Description
400
Invalid Input
id
Catalogue id is required.
This field may not be blank.
Catalogue id is not valid.
Catalogue does not exist.
All other error responses of create catalogue.

Delete Catalogue

delete
https://<domain>/<api prefix>/<version>/commerce/product/delete/catalogue/?id=<id>

Sample Code

Node
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://<domain>/<api prefix>/<version>/commerce/product/delete/catalogue/?id=<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/catalogue/?id=<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

Status Code
Error Type
FIeld
Description
401
Request Failed
Catalogue can't delete or remove
400
Invalid Input
id
Catalogue id is not valid.
Catalogue does not exist. This field may not be blank Catalogue id is required.