【问题标题】:Magento oauth error for fetch product获取产品的Magento oauth错误
【发布时间】:2013-01-25 03:29:19
【问题描述】:

当我们获取产品时,magento 中存在类似“无效的身份验证/错误请求(收到 403,预期的 HTTP/1.1 20X 或重定向)”的错误。 我的代码如下。

$resourceUrl = "http://localhost/magento/api/rest/products"; 
$oauthClient->fetch($resourceUrl, array(), 'GET', array('Content-Type' => 'application/json'));
$productsList = json_decode($oauthClient->getLastResponse());

我通过这个url完成了用户认证

http://www.magentocommerce.com/api/rest/authentication/oauth_authentication.html.

请解决我的问题..

【问题讨论】:

    标签: php api magento oauth product


    【解决方案1】:

    您想授予客户/访客访问权限。

    按照这个步骤..

    转到magento管理面板System->Webservice->REST Roles->Customer->Resources Access->SET ALL

    并且还转到 System->Webservice->REST Roles->Guest->Resources Access ->SET ALL

    同样进入系统->Webservice->REST Attribute->Customer->Resources Access ->SET ALL

    并且还转到系统->Webservice->REST 属性->Guest->资源访问->SET ALL

    现在检查您的 magento 中是否有产品,并将网站(例如主网站)分配给产品。

    现在打印有问题的 $productsList,您将看到所有产品数组。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-27
      • 2014-02-01
      相关资源
      最近更新 更多