php - How to setup Magento to get products using REST -
i don't know urls use products using rest in magento. i'm using tutorials:
http://inchoo.net/ecommerce/magento/configure-magento-rest-and-oauth-settings/
and
http://inchoo.net/ecommerce/magento/consuming-magento-rest-zend_oauth_consumer/
problem urls in format: http://magento.loc/magento/index.php/admin/index
but in these tutorials there no index.php.
in code looks:
$params = array( 'siteurl' => 'http://magento.loc/magento/index.php/oauth', 'requesttokenurl' => 'http://magento.loc/magento/index.php/oauth/initiate', 'accesstokenurl' => 'http://magento.loc/magento/index.php/oauth/token', 'authorizeurl' => 'http://magento.loc/magento/index.php/admin/oauth_authorize', 'consumerkey' => '381ywp8r50hxzjw62srozns7pbzzhzrn', 'consumersecret' => 'zhjo3nciz9qj3dv6ts6g4bttixg0dqy9', 'callbackurl' => 'http://magento.loc/magento/index.php/genr /test/callback', );
and @ bottom: $restclient->seturi('http://magento.loc/magento/index.php/api/rest/products');
using configuration no results when enter:
http://magento.loc/magento/index.php/genre/test/index
in browser url, authorize application question, , after press authorize, page returns code 200, no products return ( when printing json response 404 not found)
i found solution:
'siteurl' => 'http://magento.loc/magento/oauth', 'requesttokenurl' => 'http://magento.loc/magento/oauth/initiate', 'accesstokenurl' => 'http://magento.loc/magento/oauth/token', 'authorizeurl' => 'http://magento.loc/magento/admin/oauth_authorize', 'consumerkey' => '381ywp8r50hxzjw62srozns7pbzzhzrn', 'consumersecret' => 'zhjo3nciz9qj3dv6ts6g4bttixg0dqy9', 'callbackurl' => 'http://magento.loc/magento/genre/test/callback'
and after :
$restclient->seturi('http://magento.loc/magento/api/rest/products');
issue didn't assign role current logged admin user in magento. system > permission > users > , check rest role admin user. there no need write /index.php in url
Comments
Post a Comment