Recipe - Food - Nutrition

부분 유료
Verified
분류별 David | 업데이트됨 a month ago | Food
인기

9.9 / 10

지연 시간

1,485ms

서비스 수준

100%

Health Check

N/A

모든 토론으로 돌아가기

pagination support for Complex Recipe Search?

Rapid account: Juji 555
juji555
8 years ago

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 years ago

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 years ago

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 years ago

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 years ago

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 😃

아래에 의견을 추가하고 토론에 참여하세요.

새 댓글을 게시하려면 로그인 / 가입