【问题标题】:Magento API - proper home URLMagento API - 正确的主页 URL
【发布时间】:2019-01-26 22:36:46
【问题描述】:

我安装了 Magento2。管理网站很容易访问: http://devstore.panstore.eu/magento2/web/adminedit/admin

如果我尝试: http://devstore.panstore.eu/magento2/web/rest/products

我得到: 无法处理指定的请求。

如果我尝试:

http://devstore.panstore.eu/magento2/web/rest/oauth_authorize?auth_consumer_key=consumer_key&oauth_consumer_secret=consumer_secret

我得到相同的响应:无法处理指定的请求。

我认为我的基本 URL 是错误的。

在我的示例中,基本 URL 是什么? 如何授权才能调用产品列表服务。

不幸的是,Magento 文档对于快速启动完全没用。 没有任何功能性的邮递员集合,没有简单的分步指南可以跳入。我在 NET 上没有找到解决方案。

【问题讨论】:

    标签: magento2


    【解决方案1】:

    经过很长时间的学习,结果就在这里,实时节省。

    在我的特定情况下,基本网址是:http://devstore.panstore.eu/magento2/web

    您只需通过此 URL 获得用于身份验证的令牌:

    your_token = http://base_url/rest/V1/integration/admin/token?username=your_user&password=your_pass

    your_user 和 your_pass 在 Magento 管理员用户中定义,也添加适当的角色。

    收到令牌后,将此标头添加到 GET 请求中:

    授权:不记名your_token

    然后简单地通过 REST 路径调用 Magento 2 服务(这个获得一个 SKU = 24-MB01 的产品):

    http://base_url/rest/default/V1/products/24-MB01

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-10-24
      • 1970-01-01
      • 1970-01-01
      • 2012-05-15
      • 2018-05-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多