Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento2 REST API. Attribute to attribute group

Is there any way to assign attribute to attribute group through REST API(http://devdocs.magento.com/swagger/index_20.html)?

I can assign attribute group to attribute set, but did not find way assign attribute to attribute group. Any ideas?

like image 356
Mindaugas Avatar asked Mar 29 '26 17:03

Mindaugas


1 Answers

I know this is old, but i thought I'd share my answer for fellow googler's. I stumbled across this question when searching for a way to check if an attribute has already been assigned to a group. If anybody has an answer I'd love to hear it!

The Endpoint, CatalogProductAttributeManagementV1 (https://yourmagentohost.com/rest/{all|default}/V1/products/attribute-sets/attributes), is described in Magento 2 Swagger Doc as having a POST'ing method that will assign an attribute to an attribute set.

However, it fails to mention that it also assigns the attribute to a group at the same time using the attributeGroupId property:

Implementation Notes

Assign attribute to attribute set

Body (Content in POST)

{
    "attributeSetId": 0,
    "attributeGroupId": 0,
    "attributeCode": "string",
    "sortOrder": 0
}

Response

"integer as string?"
like image 96
Eddie Ted Crocombe Avatar answered Apr 02 '26 23:04

Eddie Ted Crocombe