I am planning to create a URL Based api which enable me to fetch resources using curl. For example, If a client can request the resource by using the following url structure.

curl -some-variable http://mydomainname/magentoroot/api.php?func=addtwonum&parama=34&paramb=11

It should produce response within xml or json. Assume public key and private key encryption and decryption are done.

Is it a feasible method?? Or shall I go to REST or SOAP. I am much inclined to this method.

  • You can use $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($your_result)); in your controller to produce response json data. Jul 7, 2015 at 6:58

1 Answer 1


I would use REST. Magento 2 comes with REST APIs standard, and its easy to create a webapi.xml file to bind REST URLS to your own APIs you introduce as well. See http://devdocs.magento.com then go to "web services developer" in the menu bar. There are examples using CURL there as well.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.