RESTful API for Magento 1.9X
Posted by Pranjal on April 14, 2 017
It all started with CodeFire getting asked by a client to create Native Mobile application for Magento 1.9 version.
Just to give you a little more background, CodeFire has been working on Magento platform quite a lot and we have done some work on Magento that we are really #proudOf. We know that Magento is a rich / powerful and huge eCommerce platform, however, is not the easiest platform to understand and customize.
Also, overjoyed by the success of our native mobile platforms for OpenCart (http://www.nativeopencartapp.com/), Magento was next on our list of platforms to support.
Little did we know how difficult this project will turn out to be!
Since this project was already on our product roadmap, and a client approached us to build the same thing, it was a win-win. We immediately jumped on the project and without giving it a second thought and signed up for it.
Next step was the UI design for the mobile app and parallel work on API development. We were under the impression that magento being such huge platform, with so much functionality available, it would definitely have the REST API available and we shall customize the existing piece and add whatever was missing.
After a week worth of work, we realized that Magento did not have a REST API that could be used for frontend application development. Not only that, there is NO RESTFUL API Module for Magento available anywhere. No free module and No Paid module!!!
Let me restate it, so there is no confusion. We found that No One has SUCCESSFULLY developed any RESTFul API for Magento 1.9X EVER! At least not the one that is available on web.
That was a good and a bad thing! Bad since we were stuck, we had already committed to client that we are going to deliver the APP and 1 week into it we realized that this is a no go project.
Good thing since this was an opportunity to do something that was not done before!
First things first though, we immediately informed and appraised the client about the situation. We also gave him our assurance that we are willing to do all the research and development (RnD) needed to create that API without any extra cost to him. However, end of this RnD phase could be, that we come back and tell him that its not been done before and we also cannot do it! Or it could be that yes we can do it! The client was game for this and we started the next phase of full fledged research and "digging" as we call it.
Each day was a challenging and frustrating at the same time, with no real progress at all, all our attempts were met with a road block and at one point we thought we may end up re-writing complete Magento codebase!
We at CodeFire may not be doing what Elon Musk is doing with his #moonshotProjects, but we have that DNA of not giving up, at least not easily! At one point this project seemed like a #moonshot in its own.
Around 10 days of hard work and research yielded no results, we were not seeing any light at the end of the tunnel. But yes, that "digging" was helping us further our knowledge on Magento platform.
After a couple weeks, when we had no hope left, we came up with a #hack that we thought may work. It was a #lightbulb moment of sorts. We knew this #hack existed, we had used it in past, but it never really occurred to us before this in the Magento Context! We again invested around 5 days of work in that #hack to see if it would work. Initial results were encouraging.
Further research, development, testing, discussion, re-development lead to development of a RESTful API for Magento 1.9X platform.
So a project that should have taken 5 to 10 days has already taken more than 30 already.
Current Status:
The API has been developed, it is currently in beta testing internally. And it requires a lot of testing before it will be production ready. If you are interested, the API has following features.
- Login
- Product Management
- Category Listing
- Profile Management
- Payment Gateway
- Product Shipping
- Shopping Cart
- Check-out
We are really thankful to our clients who help us push the boundaries and are willing to stand by us if we fail. #WeLoveSuchClients
It is projects like these that help us feel proud of ourselves and make it worth doing what we do!