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.


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




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


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


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.