Wednesday, June 5, 2013

Magento XMLRPC Credit Memo List with Filter


Magento XMLRPC Credit Memo List with Filter

There are some examples of using credit memos on the Magento API documentation web page:


But the only examples there are for the SOAP implementation.  However, the Magento API also supports the XMLRPC protocol. 

The following code works as is for the Zend_XmlRpc_Client, but the key thing is the parameter formatting, which is not platform specific.

$params = array( array(‘order_id’ => ‘12345678’),
                  array(‘whatever_field’ => $target_val),
                  array(‘another_field’ => $another_val),
          );

$this->client = new Zend_XmlRpc_Client($apiUrl);

$session = $this->client->call('login', array($this->apiUser, $this->apiKey));

$response = $this->client->call('call',
                 array($session, 'sales_order_creditmemo.list', $params));

1 comment: