Product Attribute
Manage product attributes

Create attribute

post
β€Ž
β€Ž https://<domain>/<api prefix>/<version>/commerce/product/create/attribute/

Sample Code

Node
1
var request = require('request');
2
var options = {
3
'method': 'POST',
4
'url': 'β€Ž https://<domain>/<api prefix>/<version>/commerce/product/create/attribute/',
5
'headers': {
6
'apikey': '<apikey>',
7
'Authorization': 'Bearer <access token>'
8
},
9
body: JSON.stringify({"name":{"en":"<name in english>","de":"<name in german>"},"data_type":"<attribute data type>","attribute_for":"<attribute for>","widget":"<widget type>","description":{"en":"<description in english>","de":"<description in german>"},"is_unique":"<is unique value>","is_required":"<is required>","is_display":"<need to display>","options":[{"status":"<attribute option status>","label":"<attribute option label>","value":"<attirbute option value>","weight":"<attirbute option weight>"},{"status":"<attribute option status>","label":"<attribute option label>","value":"<attirbute option value>","weight":"<attirbute option weight>"}]})
10
​
11
};
12
request(options, function (error, response) {
13
if (error) throw new Error(error);
14
console.log(response.body);
15
});
16
​
Copied!
PHP
1
<?php
2
​
3
$curl = curl_init();
4
​
5
curl_setopt_array($curl, array(
6
CURLOPT_URL => "https://<domain>/<api prefix>/<version>/commerce/product/create/attribute/",
7
CURLOPT_RETURNTRANSFER => true,
8
CURLOPT_ENCODING => "",
9
CURLOPT_MAXREDIRS => 10,
10
CURLOPT_TIMEOUT => 0,
11
CURLOPT_FOLLOWLOCATION => true,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => "POST",
14
CURLOPT_POSTFIELDS =>"{\"name\":{\"en\":\"<name in english>\",\"de\":\"<name in german>\"},\"data_type\":\"<attribute data type>\",\"attribute_for\":\"<attribute for>\",\"widget\":\"<widget type>\",\"description\":{\"en\":\"<description in english>\",\"de\":\"<description in german>\"},\"is_unique\":\"<is unique value>\",\"is_required\":\"<is required>\",\"is_display\":\"<need to display>\",\"options\":[{\"status\":\"<attribute option status>\",\"label\":\"<attribute option label>\",\"value\":\"<attirbute option value>\",\"weight\":\"<attirbute option weight>\"},{\"status\":\"<attribute option status\",\"label\":\"<attribute option label>\",\"value\":\"<attirbute option value>\",\"weight\":\"<attirbute option weight>\"}]}",
15
CURLOPT_HTTPHEADER => array(
16
"apikey: <apikey>",
17
"Authorization: Bearer <access token>"
18
),
19
));
20
​
21
$response = curl_exec($curl);
22
​
23
curl_close($curl);
24
echo $response;
25
​
Copied!

Error Responses

Status Code
Error Type
Field
Description
400
Validation Error
name
Name for {language code} language is required.
400
Validation Error
description
Description for {language code} langauge is required.
​
400
Validation Error
widget
{widget name} is not a valid choice. Supported widgets are {widgets}.
400
Validation Error
widget
{widget name} is not a valid choice. Supported widgets for data type {data type} is/are {widget/widgets}.
400
Validation Error
data_type
{data_type} is not a valid choice. Supported data types are {data}.
400
Validation Error
widget
{widget} widget can't be selected for an {data_type} data type.
400
Validation Error
options
The selected widget-data_type attribute doesn't support any options. leave it as empty or no need to mention.
400
Validation Error
options
This field is required.
400
Validation Error
name
All languages of names must have a description of the corresponding language.

List Attributes

get
β€Ž
β€Ž https://<domain>/<api prefix>/<version>/commerce/product/list/attributes/

Sample Node

Node
1
var request = require('request');
2
var options = {
3
'method': 'GET',
4
'url': 'β€Ž https://<domain>/<api prefix>/<version>/commerce/product/list/attributes/',
5
'headers': {
6
'apikey': '<apikey>',
7
'Authorization': 'Bearer <access token>'
8
}
9
};
10
request(options, function (error, response) {
11
if (error) throw new Error(error);
12
console.log(response.body);
13
});
14
​
Copied!
PHP
1
<?php
2
​
3
$curl = curl_init();
4
​
5
curl_setopt_array($curl, array(
6
CURLOPT_URL => "https://<domain>/<api prefix>/<version>/commerce/product/list/attributes/",
7
CURLOPT_RETURNTRANSFER => true,
8
CURLOPT_ENCODING => "",
9
CURLOPT_MAXREDIRS => 10,
10
CURLOPT_TIMEOUT => 0,
11
CURLOPT_FOLLOWLOCATION => true,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => "GET",
14
CURLOPT_HTTPHEADER => array(
15
"apikey: <apikey>",
16
"Authorization: Bearer <access token>"
17
),
18
));
19
​
20
$response = curl_exec($curl);
21
​
22
curl_close($curl);
23
echo $response;
24
​
Copied!

Get A Attribute

get
β€Ž
https://<domain>/<api prefix>/<version>/commerce/product/get/attribute/<attribute id>/

Sample code

Node
1
var request = require('request');
2
var options = {
3
'method': 'GET',
4
'url': 'β€Žhttps://<domain>/<api prefix>/<version>/commerce/product/get/attribute/<attribute id>/',
5
'headers': {
6
'apikey': '<apikey>',
7
'Authorization': 'Bearer <access token>'
8
}
9
};
10
request(options, function (error, response) {
11
if (error) throw new Error(error);
12
console.log(response.body);
13
});
14
​
Copied!
PHP
1
<?php
2
​
3
$curl = curl_init();
4
​
5
curl_setopt_array($curl, array(
6
CURLOPT_URL => "https://<domain>/<api prefix>/<version>/commerce/product/get/attribute/<attribute_id>/",
7
CURLOPT_RETURNTRANSFER => true,
8
CURLOPT_ENCODING => "",
9
CURLOPT_MAXREDIRS => 10,
10
CURLOPT_TIMEOUT => 0,
11
CURLOPT_FOLLOWLOCATION => true,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => "GET",
14
CURLOPT_HTTPHEADER => array(
15
"apikey: <apikey>",
16
"Authorization: Bearer <access token"
17
),
18
));
19
​
20
$response = curl_exec($curl);
21
​
22
curl_close($curl);
23
echo $response;
24
​
Copied!

Delete Attribute

delete
β€Ž
https://<domain>/<api prefix>/<version>/commerce/product/delete/attribute/<attribute id>/

Sample code

Node
1
var request = require('request');
2
var options = {
3
'method': 'DELETE',
4
'url': 'https://<domain>/<api prefix>/<version>/commerce/product/delete/attribute/<attribute_id>/',
5
'headers': {
6
'apikey': '<apikey>',
7
'Authorization': 'Bearer <access token>',
8
}
9
};
10
request(options, function (error, response) {
11
if (error) throw new Error(error);
12
console.log(response.body);
13
});
14
​
Copied!
PHP
1
<?php
2
​
3
$curl = curl_init();
4
​
5
curl_setopt_array($curl, array(
6
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/commerce/product/delete/attribute/<attribute_id>/',
7
CURLOPT_RETURNTRANSFER => true,
8
CURLOPT_ENCODING => '',
9
CURLOPT_MAXREDIRS => 10,
10
CURLOPT_TIMEOUT => 0,
11
CURLOPT_FOLLOWLOCATION => true,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => 'DELETE',
14
CURLOPT_HTTPHEADER => array(
15
'apikey: <apikey>',
16
'Authorization: Bearer <access token>',
17
),
18
));
19
​
20
$response = curl_exec($curl);
21
​
22
curl_close($curl);
23
echo $response;
24
​
Copied!

Update Attribute

post
β€Ž
https://<domain>/<api prefix>/<version>/commerce/product/update/attribute/<attribute id>/

Sample code

Node
1
var request = require('request');
2
var options = {
3
'method': 'POST',
4
'url': 'https://<domain>/<api prefix>/<version>/commerce/product/update/attribute/<attribute_id>/',
5
'headers': {
6
'apikey': '<apikey>',
7
'Authorization': 'Bearer <access token>',
8
},
9
body: JSON.stringify({"name":{"en":"<name in english>","de":"<name in german>"},"data_type":"<attribute data type>","attribute_for":"<attribute for>","widget":"<widget type>","description":{"en":"<description in english>","de":"<description in german>"},"is_unique":"<is unique value>","is_required":"<is required>","is_display":"<need to display>","options":[{"status":"<attribute option status>","label":"<attribute option label>","value":"<attirbute option value>","weight":"<attirbute option weight>"},{"status":"<attribute option status>","label":"<attribute option label>","value":"<attirbute option value>","weight":"<attirbute option weight>"}]})
10
​
11
};
12
request(options, function (error, response) {
13
if (error) throw new Error(error);
14
console.log(response.body);
15
});
Copied!
PHP
1
<?php
2
​
3
$curl = curl_init();
4
​
5
curl_setopt_array($curl, array(
6
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/commerce/product/update/attribute/<attribute_id>/",
7
CURLOPT_RETURNTRANSFER => true,
8
CURLOPT_ENCODING => '',
9
CURLOPT_MAXREDIRS => 10,
10
CURLOPT_TIMEOUT => 0,
11
CURLOPT_FOLLOWLOCATION => true,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => 'POST',
14
CURLOPT_POSTFIELDS =>'{
15
"name":{"en":"<name>"},
16
"description":{"en":"<description>"},
17
"data_type":"<data_type>",
18
"widget":"<widget>",
19
"options":[{"status": <status>,"label":"<attribute_option_label>","value":"<value>","weight":<weight>}]
20
}',
21
CURLOPT_HTTPHEADER => array(
22
'apikey: <apikey>',
23
'Authorization: Bearer <access token>'
24
),
25
));
26
​
27
$response = curl_exec($curl);
28
​
29
curl_close($curl);
30
echo $response;
Copied!
Last modified 1mo ago