Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extend current API's in Magento to get items in JSON format

Tags:

json

api

magento

I am a beginner to Magento. I am trying to extend the current API classes in Magento to fulfill my requirements and retrieve data in JSON format. I need:

  1. I need to get all stores in a website
  2. I need to get all Categories and Subcategories in a specific store
  3. I need to get all products in a specific Category.
  4. All data retrieved should be in JSON format.

Any blog/Forum topic? Any kind of help?

Thanks in advance.

like image 800
Damodaran Avatar asked Nov 30 '10 05:11

Damodaran


People also ask

What is REST API in magento2?

The Magento REST API defines a set of functions that a developer can use to perform requests and receive responses. These interactions are performed using the HTTP protocol. The caller issues an HTTP request, which contains the following elements: An HTTP header that provides authentication and other instructions.

What framework does Magento 2 use for its REST API?

Magento uses Swagger to display REST APIs for all installed products and allows you to try out the APIs.


1 Answers

Please refer to this Magento wiki page http://www.magentocommerce.com/wiki/doc/webservices-api/custom-api#creating_custom_adapter_for_api.

Steps:

  1. You need to create a new API Server Adapter that should implement Mage_Api_Model_Server_Adapter_Interface.

  2. Create a controller that will run your api server adapter

  3. Implement Mage_Api_Model_Server_Adapter_Interface::run() method for process JSON request and return result in JSON. See Mage_Api_Model_Server_Handler_Abstract for understanding Magento API workflow.

like image 87
Ivan Chepurnyi Avatar answered Nov 06 '22 20:11

Ivan Chepurnyi