Extend product_media.list API to retrieve images always from configurable product

Don’t you think updating the same contents like media images and other attributes in all simple products of a configurable product is an overhead?

For easier management, it’s better to update frontend visible data only in the configurable product. But this may lead missing of data if someone makes an API call for a simple product, for example, product_media.list

But we have a solution i.e. to retrieve the data (ex. images) always from the configurable product.
1. Define XML Rewrite


2. Extend Mage_Catalog_Model_Product_Attribute_Media_Api


 * @category   MagePsycho
 * @package    MagePsycho_Apiextender
 * @author     [email protected]
 * @website    https://www.magepsycho.com
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
class MagePsycho_Apiextender_Model_Catalog_Product_Attribute_Media_Api extends Mage_Catalog_Model_Product_Attribute_Media_Api

     * Retrieve product
     * @param int|string $productId
     * @param string|int $store
     * @param  string $identifierType
     * @return Mage_Catalog_Model_Product
    protected function _initProduct($productId, $store = null, $identifierType = null)
        $product = Mage::helper('catalog/product')->getProduct($productId, $this->_getStoreId($store), $identifierType);

        //tweak $product if product is simple and part of configurable product
        if ($product && $product->getId()) {
            if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_SIMPLE) {
                $parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
                if (isset($parentIds[0])) {
                    $product = Mage::helper('catalog/product')->getProduct($parentIds[0], $this->_getStoreId($store), $identifierType);

        if (!$product->getId()) {

        return $product;

3. And you can test the API (using XML-RPC) as:

$mageFilename = '/path/to/app/Mage.php';
require_once $mageFilename;
ini_set('display_errors', 1);

    $client = new Zend_XmlRpc_Client('http://your-store.com/api/xmlrpc/');
    $session = $client->call('login', array('apiUser', 'apiPass'));

    $images = $client->call('call', array($session, 'product_media.list', array('some-sku')));

    $client->call('endSession', array($session));
} catch (Exception $e) {
    echo 'API Error:: ' . $e->getMessage();