【发布时间】:2014-06-02 14:46:53
【问题描述】:
我不知道在 magento 中使用 REST 获取产品的网址。 我正在使用教程:
http://inchoo.net/ecommerce/magento/configure-magento-rest-and-oauth-settings/
和
http://inchoo.net/ecommerce/magento/consuming-magento-rest-zend_oauth_consumer/
问题是我的网址是这种格式: http://magento.loc/magento/index.php/admin/index
但在这些教程中没有 index.php。
在我的代码中是这样的:
$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',
);
在底部: $restClient->setUri('http://magento.loc/magento/index.php/api/rest/products');
使用此配置,我在输入时没有得到任何结果:
http://magento.loc/magento/index.php/genre/test/index
在浏览器 URL 中, 我收到授权申请问题,按授权后,我得到返回代码 200 的页面, 但没有产品返回(打印 json 响应时显示 404 未找到)
【问题讨论】:
-
你有一个加号','在你的最后一个键,在 params.. 并删除 callbackurl 中的换行符。
标签: php magento rest magento-1.7