Recipe - Food - Nutrition

FREEMIUM
Verified
By David | Updated לפני 15 ימים | Food
Popularity

9.9 / 10

Latency

487ms

Service Level

100%

Health Check

N/A

Back to All Discussions

pagination support for Complex Recipe Search?

Rapid account: Juji 555
juji555
לפני 8 שנים

I would like to use pagination in my app. I want the user to get the first 100 recipes with Complex Recipe Search, then, if they don’t like any of the options, click next to get 100 more recipes. Here’s how github does it, for example: https://developer.github.com/guides/traversing-with-pagination/

Are there any plans to implement pagination in spoonacular?

Rapid account: Juji 555
juji555 Commented לפני 8 שנים

Okay, I switched to infinite scroll instead of pagination, that way I don’t have to know the total number of recipes I search would return. I just keep asking for more until there are no more left.

Rapid account: Spoonacular
spoonacular Commented לפני 8 שנים

I have this already on my todo but unfortunately it is currently not that easy - or more so rather computationally expensive - to find out how many recipes would match in total after I found the requested amount. I will look into adding this, for now, maybe you just show a “next page” button? Also, looking at paging behavior in general, people tend to not look past the first page anyway so most of the effort must be put into the top search results. Also a good read is the first answer here: http://ux.stackexchange.com/questions/36394/when-is-it-better-to-paginate-and-not-to-paginate

Anyway I have it on my todo for the future 😃

Rapid account: Juji 555
juji555 Commented לפני 8 שנים

Offset and number get me almost all the way there. The one thing that’s missing that I need the endpoint to return is the total number of recipes. I need the total number of recipes for any given complex search so that I can calculate how many pages to paginate through (number of pages = total number of recipes / recipes per page). Is this something you could add? This is different than the existing number attribute which maxes out at 100. I’m fine with only being able to get 100 recipes at a time, but I need to know: 100 of how many?

Rapid account: Spoonacular
spoonacular Commented לפני 8 שנים

Hi,

The complex search endpoint has an offset and number parameter (https://market.mashape.com/spoonacular/recipe-food-nutrition#complex-recipe-search) which can be used for pagination already 😃

Join in the discussion - add comment below:

Login / Signup to post new comments