Recipe - Food - Nutrition

フリーミアム
Verified
よって David | 更新済み एक महीने पहले | Food
人気

9.9 / 10

レイテンシー

1,485ms

サービスレベル

100%

Health Check

N/A

すべてのディスカッションに戻る

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 😃

ディスカッションに参加しましょう-以下にコメントを追加してください:

ログイン/サインアップして新しいコメントを投稿