简体   繁体   English

如何通过shopify_api gem从Shopify检索订单?

[英]How to retrieve orders from Shopify through the shopify_api gem?

I am in the process of integrating an app to Shopify. 我正在将应用程序集成到Shopify。 I am using the shopify_api gem to retrieve orders, but I am finding that the documentation and Readme does not cover much. 我正在使用shopify_api gem来检索订单,但我发现文档自述文件的内容并不多。 And the REST API documentation does not easily translate into shopify_api methods. REST API文档不容易转换为shopify_api方法。

I have read that you can query for orders with params, but I get 50 more or less random orders returned when doing so: 我已经读过你可以查询带有参数的订单,但是当我这样做时,我会得到50个或多或少的随机订单:

puts ShopifyAPI::Order.find(:all, params: { order_number: 1606 }).size # => 50

I would also like to be able to retrieve orders from a given created_at date and from a given order_number . 我还希望能够从给定的created_at日期和给定的order_number检索订单。

To give you a bit more info on where to look in the docs, this would be a good start: 为了向您提供有关在文档中查找位置的更多信息,这将是一个良好的开端:

http://docs.shopify.com/api/order#index http://docs.shopify.com/api/order#index

This gives you the full list of parameters you can filter/query by. 这将为您提供可以过滤/查询的完整参数列表。

So for example: 例如:

puts ShopifyAPI::Order.find(:all, :params => {:status => 'any', :limit => 250})

Let me know if you have more specific question on a particular filter/query you are attempting. 如果您对正在尝试的特定过滤器/查询有更具体的问题,请与我们联系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM