Group Attributes
Manage Group Attributes Filter
List attributes group
GET
ββ https://<domain>/<api prefix>/<version>/commerce/product/list/attribute-groups/
This API endpoint will give you the list of attributes group.
Query Parameters
numeric - The offset indicates the starting position of the query in relation to the complete set of unpaginated items.
The limit indicates the maximum number of items to return, default maximum number is 50, and maximum limit is 100.
βHTTP/1.1 200 OK
Content-Type: application/json
β
Body:
{
"status_code": 200,
"errors": {},
"data": {
"results": [
{
"id": <attribute_group_id>,
"name": "<attribute_group_name>",
"attribute_id": [
{
"id": <attribute_id>,
"machine_code": "<attribute_machine_code>",
"name": "<attribute_name>",
"description": "<attribute_description>",
"widget": "<attribute_widget_type>",
"attribute_for": "<attribute_for>",
"is_unique": <is_unique_boolean>,
"is_required": <is_required_boolean>,
"is_display": <is_display_boolean>,
"options": [
{
"label": "<option_label>",
"value": "<option_value>",
"status": <option_status_boolean>,
"weight": <option_weight>
},
...
],
"data_type": "<attribute_data_type>",
"status": <attribute_status>,
"created": "<created_date_time>"
},
...
],
"status": <attribute_group_status>,
"created": "<created_date_time>"
},
...
],
"count": <list_count>,
"previous": <link_for_previous_page_list>,
"next": <link_for_next_page_list>
}
}
Sample Code
Node
var request = require('request');
var options = {
'method': 'GET',
'url': 'βhttps://<domain>/<api prefix>/<version>/commerce/product/list/attribute-groups/',
'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/attribute-groups/",
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 attributes group
POST
βββββββββββββββββββhttps://<domain>/<api prefix>/<version>/commerce/product/create/attribute-groups/
This API endpoint will create an attributes group.
Request Body
Attribute id - require an array of attribute ids containing at least one attribute id.
βHTTP/1.1 200 OK
Content-Type: application/json
β
Body:
{
"status_code": 200,
"errors": {},
"data": {}
}
Sample Code
Node
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://<domain>/<api prefix>/<version>/commerce/product/create/attribute-groups/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>',
},
body: JSON.stringify({"name":"<name>","attribute_id":["<attribute_id>","<attribute_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/attribute-groups/',
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 =>'{
"name":"<name>",
"attribute_id": ["<attribute_id>","<attribute_id>"]
}',
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.
Ensure this field has no more than 20 characters.
Attribute id is required.
attribute_id is not valid or This field may not be blank.
attribute_id is not exist.
Update attributes group
POST
βββββββββββββββββββhttps://<domain>/<api prefix>/<version>/commerce/product/update/attribute-groups/
This API endpoint will update an attributes groups.
Request Body
Id of an attributes group that wants to update.
Give a new name if u want to update the name of the group else give the existing name.
An array of attribute ids that wants to remove from the attributes group.
An array of attribute ids that wants to add to the attributes group.
βHTTP/1.1 200 OK
Content-Type: application/json
β
Body:
{
"status_code": 200,
"errors": {},
"data": {}
}
Sample Code
Node
var request = require('request');
var options = {
'method': 'POST',
'url': 'ββββββββββββββββββhttps://<domain>/<api prefix>/<version>/commerce/product/update/attribute-groups/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>',
},
body: JSON.stringify({"attrgroup_id":"<attrgroup_id>","name":"<name>","add_attr":["<attr_id>","<attr_id>",...],"remove_attr":["<attr_id>","<attr_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/attribute-groups/',
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 =>'{
"attrgroup_id":"<attrgroup_id>",
"name":"<name>",
"add_attr": ["<attr_id>","<attr_id>",...],
"remove_attr": ["<attr_id>","<attr_id>",...]
}',
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access token>',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Error Responses
This field is required.
attrgroup_id is not valid or This field may not be blank
This field is required.
This field may not be blank.
Ensure this field has no more than 20 characters.
<attribute_id> is not valid or This field may not be blank.
<attribute_id> is not exist.
<attribute_id> is already exist in group.