API Question, Order: "Page"?

New Member
25 0 0
Quick question, we were wondering what the PAGE option does in relation to getting data via the API for orders. We're able to get very far with receiving and working with order data via the API -- but were wondering what the PAGE option is intended to do; mostly because we can use limit to limit the total returned amount. Does "PAGE" only show you 50 orders, b/c 50 orders are on a page? Something like that? Our bottom-line is we are looking for a quick method to extract a total order count for a shop. Any ideas? Thanks for the help! We're working hard on our series of Shopify Apps! --Ari
SDG - Spiegel Design Group, Inc. - www.spiegeldg.com
0 Likes
New Member
2 0 0

Thanks for such a nice post.

Regards
Loop

Tennis Scholarships
Volleyball Scholarships
Softball Scholarships

0 Likes
Tourist
128 0 1

You’re correct in what the page option does. You need both to access a specific range of orders. For example, if you set the limit to 50, then page 1 would have 1 – 50, page 2 would have 51-100, etc.

However, I don’t think there’s a way to get the total count of orders for a shop. This would be a great addition to the API.

Mike Larkin | http://www.pixellent.com | http://www.fetchapp.com | mikelarkin [at] pixellent [dot] com
0 Likes
Shopify Staff
Shopify Staff
195 0 3

Hey Mike,

I agree that having that sort of functionality in the API would be really handy.

Next week I’ll be prototyping what we’ll need to have something like


   GET /admin/orders/size => 20

which will take the same parameters (for search conditions) as /admin/orders and will only respond to GET.

I’ll keep you guys updated.

Edward Ocampo-Gooding – Shopify Developer Advocate
0 Likes
New Member
25 0 0

Excellent; thanks for the update.

SDG - Spiegel Design Group, Inc. - www.spiegeldg.com
0 Likes
Tourist
7 0 1

Statement_1 =
If you have 500 orders and you set :limit => 5 but you don’t set :page, you get 5 orders?

Statement_2 =
If you have 500 orders and you set :limit => 10 and you set :page => 2, you get orders 10-20?

Statement_1 && Statement_2 == true?

0 Likes
Shopify Staff
Shopify Staff
2002 0 40

Timcase, both are correct. Think of it from the point of view of the HTML interface and how pagination works there. Essentially all what changes for the API is that you add .xml to the url and we will sent the XML representation of the same items on the wire as we would usually display in html. This also means that all the query parameters from the API work in html as well (e.g. you can bookmark a screen that only shows orders that were placed since a certain date for example).

Tobias Lütke - Shopify CEO // http://twitter.com/tobi
0 Likes
Shopify Staff
Shopify Staff
195 0 3

Hi Tim,


/admin/orders/count

and friends now works with the conditions that you’re used to.

The shopify_api.rb file included in the shopify_app plugin has also been updated so that you can do


ShopifyAPI::Order.count(:status => "shipped")

and it’ll return what you expect.

See http//api.shopify.com for more.

(Yes, the api docs do need some love; it’s on the list :)

Edward Ocampo-Gooding – Shopify Developer Advocate
0 Likes