【问题标题】:Magento rest api: how to get orders by ids?Magento rest api:如何通过 id 获取订单?
【发布时间】:2014-07-30 13:25:40
【问题描述】:

如何在rest api的帮助下从magento获取多个按Id过滤的订单?

我尝试使用http://192.168.0.104:4422/magento/api/rest/orders?filter[1][attribute]=entity_id&filter[1][in]=1&filter[1][in]=3

但它返回我:

<magento_api>
<messages>
<error>
<data_item>
<code>401</code>
<message>oauth_problem=signature_invalid</message>
</data_item>
</error>
</messages>
</magento_api>

但如果我只使用一个过滤器in 参数http://192.168.0.104:4422/magento/api/rest/orders?filter[1][attribute]=entity_id&amp;filter[1][in]=1 的请求 - 它效果很好。

【问题讨论】:

  • 您是否为它创建了其余用户角色?
  • 是的,magento 和所有其他 stuf 配置良好,问题仅出现在具有多个“in”参数的请求中。
  • @burzhuy,你解决了吗?我也很想知道。
  • @d4v1dv00 看我的回答

标签: magento rest magento-1.8


【解决方案1】:

对我来说,问题出在过滤器上(我在 1.7.0.1 上尝试过)。看起来某些 magento 版本的过滤器有问题。因此,您应该使用 1 个过滤器,然后该过滤器会生成您的代码。

【讨论】:

    【解决方案2】:

    我找到了答案in this blog post。简而言之,如果您遵循这种结构(这是针对我的产品列表的用例):

    http://magentohost.com/api/rest/products?filter[1][attribute]=entity_id&filter[1][in][1]=1&filter[1][in][2]=3
    

    你会准备好的! (这会得到两个与上面类似的产品,ID 为 1 和 3)。注意[1][2][in] 之后。我希望 Magento 有更好的文档。

    【讨论】:

      【解决方案3】:

      尝试聚合值。

      complexFilter { key = "increment_id", value = new associativeEntity {key = "in", value = "1,2,3"} };
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2015-05-16
        • 1970-01-01
        • 2015-03-01
        • 2018-01-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多