Magento 2.0 API Issue in Attribute Set

Magento 2.0 API Issue in Attribute Set

Everyone is trying hard to work on the all new Magento 2.0 eCommerce Platform which Magento rolled out in Q4 2015. It’s a completely new architecture to work upon for core development, design and Integration. To cater our product roadmap of releasing Magento 2.0 Integration with popular ERP systems such as SAP Business One, MS Dynamics NAV; we are working deeply in the API level, finding out many issues and developing solutions to resolve that. Below is one such issue which we would like to mention, we believe the issue and it’s solution will help other Magento Partners.

ISSUE MAGENTO 2: REST API: GET /V1/products/attribute-sets/{attributeSetId}/attributes does not work for any new attribute set.

Details:

If any new attribute set is created and REST API: GET /V1/products/attribute-sets/{attributeSetId}/attributes is executed then it throws an error:
Error:
{
“message”: “Internal Error. Details are available in Magento log file. Report ID: webapi-574ed41d7eb6e”
}

1

Solution

integrate-magento-with-ERP-2

Go to
/vendor/magento/module-eav/Model/Entity/Attribute/ AbstractAttribute.php
Search for _getDefaultSourceModel() method and modify it as given in the below picture.

2

Just comment/remove the original code (line no. 587) and replace it with:
return $this->getEntityType()->getEntity()->getDefaultAttributeSourceModel();

Explanation

getEntityType() was missing in the original code because of which it was not able to return the value/attributes of any newly created attribute-set other than the default one.

become-appseconnect-partner

Search

Free Trial / Demo

Try the APPSeCONNECT Integration Platform for 30 Days or request a free demo.

Related Posts

appseconnect-New-Logo_2022.png

Book a Demo

Get a personalized solution for your business needs with our free integration consultation and demo.

1200+ Companies rely on APPSeCONNECT to drive growth through automation

⚡ Take the first step towards seamless integration
appseconnect-New-Logo_2022.png

Start Your Automation Journey With Pre-Built Connectors.

Get a Demo. Try it Free.

G2 Fall Badges 2023
we use cookies
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies.