It is not in-depth tutorial but description on how I tackled creation of custom API for magento. There are still vast fields of unknown but at least this will let you start building your own API and let you learn, like me, on how to do it. If I will find out anything new about it or I will gain some theoretical knowledge then I will update this post with those revelations.
While battling with the Custom API I tried to locate Varien_Object class, I couldn’t locate it nowhere within the “app” folder, when I looked again at the magento’s root folder I have noticed “lib” folder, bingo, I have found it, also I have found other code used by magento i.e. the image uploader.
It’s been frustrating hour, I’ve been sitting and trying to figure it out why my call to sales_order.list doesn’t work, I thought “it can’t be” everything is fine (looks like) but it returns
faultCode=620 faultMessage=”Method “sales_order.list” does not exist”
Still didn’t gave up on this, following is the update on my progress. I have created in magento 3 types of roles, admin, read only and customer. I wanted to check what is the difference from the API point of view. I have browsed the documentation (rather a brief list then documentation) and have found in Magento Core API the “resources” method.
And another sent from flash, I have used the metaWeblog.newPost(string blogid, string username, string password, struct content, bool publish)
Following is the structure passed as a third argument:
<value>This Post was generated, from the flash! 🙂 </value>
<value>Post From Flash!</value>