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.
Request
Response
Request
Headers
apikey
required
string
apikey
Authorization
required
string
Bearer access token
Query Parameters
offset
optional
string
numeric - The offset indicates the starting position of the query in relation to the complete set of unpaginated items.
limit
optional
string
The limit indicates the maximum number of items to return, default maximum number is 50, and maximum limit is 100.
group_name
optional
string
Attribute group name.
attr_name
optional
string
Attribute name.
Response
200: OK
​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
Response
Request
Headers
apikey
required
string
apikey
Authorization
required
string
Bearer access token
Body Parameters
name
required
string
Name of attribute
attribute_id
required
string
Attribute id - require atleast one attribute id, request with multiple attribute_id for group of attributes.
attribute_id
optional
string
​
Response
200: OK
​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>',
},
formData: {
'name': '<attribute_group_name>',
'attribute_id': '<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 => array('name' => '<attribute_group_name>','attribute_id' => '<attribute_id>','attribute_id' => '<attribute_id>'),
CURLOPT_HTTPHEADER => array(
"apikey: <apikey>",
"Authorization: Bearer <accses-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 20 characters.

400

Validation Error

attribute_id

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
Response
Request
Headers
apikey
required
string
apikey
Authorization
required
string
Bearer access token
Body Parameters
attrgroup_id
required
string
Id of an attributes group that wants to update.
name
required
string
Give a new name if u want to update the name of the group else give the existing name.
remove_attr
optional
string
Id of an attribute that wants to remove from the attributes group. remove multiple attributes by giving ids with the same key.
add_attr
optional
string
Id of an attribute that wants to add to the attributes group. add multiple attributes by giving ids with the same key.
add_attr
optional
string
​
Response
200: OK
​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>',
},
formData: {
'attrgroup_id': '<attribute_group_id>',
'name': '<attribute_group_name>',
'remove_attr': '<attribute_id>',
'remove_attr': '<attribute_id>',
'add_attr': '<attribute_id>',
'add_attr': '<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/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 => array('attrgroup_id' => '<attribute_group_id>','name' => '<attribute_group_name>','remove_attr' => '<attribute_id>','remove_attr' => '<attribute_id>','add_attr' => '<attribute_id>','add_attr' => '<attribute_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

attrgroup_id

This field is required.

attrgroup_id is not valid or This field may not be blank

400

Validation Error

name

This field is required.

This field may not be blank.

Ensure this field has no more than 20 characters.

400

Validation Error

attribute_id

<attribute_id> is not valid or This field may not be blank.

<attribute_id> is not exist.

<attribute_id> is already exist in group.

Delete attributes group

delete
​

β€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žhttps://<domain>/<api prefix>/<version>/commerce/product/delete/attribute-groups/<attribute-group id>/
This API endpoint will delete a attributes group
Request
Response
Request
Headers
apikey
required
string
apikey
Authorization
required
string
Bearer access token
Response
200: OK
​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': 'DELETE',
'url': 'β€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žhttps://<domain>/<api prefix>/<version>/commerce/product/delete/attribute-groups/<attribute-group 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/attribute-groups/<attribute-group 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

Description

404

Not Found

The requested resource not found.

​