Duplicate entry error when getting order using REST API in Magento

We will learn in this topic how to solve the REST API bug of Magento 1 while getting the order with Order REST API.

This bug inside the “Mage_Sales_Model_Api2_Order_Rest” class and this is abstract class so can’t override this via magento module override feature in config.xml

We can do this via use of “local” codepool of Magento.

We need to copy the “Mage_Sales_Model_Api2_Order_Rest” class into app/code/local/ folder of Magento.

Add following line into the file

$collection->getSelect()->group(‘main_table.entity_id’);

Here is full source of file