Magento 1.9 – How to Create Custom REST API

apimagento-1.9rest

I want to create my own custom REST API in my magento site. I am new in magento api. I have followed following tutorial to learn to put authentication for particular consumer added in magento rest consumer

  1. http://inchoo.net/magento/configure-magento-rest-and-oauth-settings/
  2. http://inchoo.net/magento/consuming-magento-rest-zend_oauth_consumer/

I have sat all the settings in REST-Oauth consumers,REST-Roles,REST-Attributes and user permission as per 1st tutorial

also added controller which should return be login screen as mentioned in tutorial 2

It says magento.loc/restconnect/test link will redirect you some login screen

when i fire my local controller url :
localhost/offer/restconnect/test/

it redirects me in following which gives 404 not found :
localhost/offer/admin/oAuth_authorize?oauth_token=47dc6c43fdc972879a761ad1370318e2

Anyone have any idea at which point i am getting wrong or which things i am missing to do.
I have used correct consumerKey and consumerSecret in TestController

Thanks 🙂

Best Answer

Issue solved! Got API authentication server login screen successfully. Problem was in my value authorizeurl set in $param array in TestController. I have changed it to 'authorizeUrl'=>'localhost/offer/admin/oauth_authorize' from 'authorizeUrl'=>'localhost/offer/admin/oAuth_authorize'. small 'a' letter solved the issue. :)