ppy/osu-api

Too much api requests to display beatmap background images

Maxluli opened this issue · 2 comments

I am making a small project where you have the users profile pages, and I want to show the beatmap background of the top_plays in the listing. In order to do this, I need the beatmapset_id to display the background image, however when using get_user_best I only get beatmap_id but I need beatmapset_id. So I need to make a new API request for each beatmap to get the beatmapset_id and get the background image wich can make a lots of avoidable calls.

Is there any way to get the beatmapset_id only with get_user_best or is it possible to add it?

cache the get_beatmap api results. The mapping from beatmapId to setId will probably never change, so if you store those values locally so you wont have to request it for a map ur application already has seen in the past

peppy commented

Caching the results is best, yep.