otigz

How limit number of sets return

Recommended Posts

I've a requirement to limit the number of sets returned for to be a minumu of 200 and max of 300, for example. The sets are returned ordered by number of parts in descending order.

Here's my code:

 

curl -X GET --header 'Accept: application/json' --header 'Authorization: key fake' 'https://rebrickable.com/api/v3/lego/sets/?page=1&page_size=301&ordering=-num_parts'

 

But I see the count of records returned is quite higher than 300!

 

 

{ "count": 15012, "next": "https://rebrickable.com/api/v3/lego/sets/?ordering=-num_parts&page=2&page_size=301", "previous": null, "results": [ { "set_num": "75192-1", "name": "UCS Millennium Falcon", "year": 2017, "theme_id": 171, "num_parts": 7541, "set_img_url": "https://cdn.rebrickable.com/media/sets/75192-1.jpg", "set_url": "https://rebrickable.com/sets/75192-1/ucs-millennium-falcon/", "last_modified_dt": "2017-09-12T10:47:01.429284Z" }, { "set_num": "71043-1", "name": "Hogwarts Castle", "year": 2018, "theme_id": 667, "num_parts": 6016, "set_img_url": "https://cdn.rebrickable.com/media/sets/71043-1.jpg", "set_url": "https://rebrickable.com/sets/71043-1/hogwarts-castle/", "last_modified_dt": "2019-01-30T23:16:59.633290Z" }, { "set_num": "10256-1", "name": "Taj Mahal", "year": 2017, "theme_id": 673, "num_parts": 5923, "set_img_url": "https://cdn.rebrickable.com/media/sets/10256-1.jpg", "set_url": "https://rebrickable.com/sets/10256-1/taj-mahal/", "last_modified_dt": "2019-08-28T00:50:35.928205Z" }, { "set_num": "10189-1", "name": "Taj Mahal", "year": 2008, "theme_id": 673, "num_parts": 5922, "set_img_url": "https://cdn.rebrickable.com/media/sets/10189-1.jpg", "set_url": "https://rebrickable.com/sets/10189-1/taj-mahal/", "last_modified_dt": "2019-08-22T09:35:31.607493Z" }, { "set_num": "SWMP-1", "name": "Star Wars / M&M Mosaic - Promo Set", "year": 2005, "theme_id": 169, "num_parts": 5461, "set_img_url": null, "set_url": "https://rebrickable.com/sets/SWMP-1/star-wars-mm-mosaic-promo-set/", "last_modified_dt": "2013-08-01T20:57:43.101954Z" }, { "set_num": "2000409-1", "name": "Window Exploration Bag", "year": 2010, "theme_id": 507, "num_parts": 5200, "set_img_url": "https://cdn.rebricka

 

What could I be missing?

 

James

Share this post


Link to post
Share on other sites

The count field shows the total number of results across all pages, but there should only be the requested number of items in the actual page of results you get.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now