osu-api
osu-api copied to clipboard
Retrieving user information in a bundle
This is an API endpoint proposal for information about multiple users at once.
Users bundle
URL
/api/get_users_bundle
Description
Retrieve a bundle of users information.
Potentional use cases
- Multiple players may be checked at once.
- More effient periodic checks.
Parameters
k- api key (required)m- mode (0 = osu, 1 = taiko, 2 = catch, 3 = mania). Optional, defaults to 0.
Request body
The request body is a JSON array of user IDs (maximum?). Example:
[12345, 45679, 456874, 987789, ...]
Response
See /api/get_user.
You're probably best off requesting each user with a get_user API call. A proposal for bulk requests (#107, but it was int the case of beatmaps) had already been done, but well, the request was declined by peppy so yeah ¯\_(ツ)_/¯
This is also a duplicate of #134. I also feel like that if anything, there shouldn't be a new method added, but rather get_users should get extended to allow multiple parameters with the same name (get_user?u=1337&u=1&u=7331)
I didn't know that it was declined before, but now that I looked at it, he did say "If you are running out of requests per minute (hitting the api limit) then you should be asking for changes." I've been hitting them for months now, so I guess it's a good time to revisit the topic.
whatever way this goes, I'm strongly against using the request body as "array of things to retrieve", since you'd need a POST-request for that, and that just doesnt make any sense whatsoever. It is retrieving information, so its a GET-request. Changing that is just weird and causes all sorts of problems with caching and proxy servers.
Good point, comma separated user IDs as a parameter should work,
I also believe this should be added (although in my case user best scores), I made a discord bot which tracks user scores, and right now I'm iterating over the array of users and getting the user scores 1 at a time (at an interval of 1 second between requests), so users tend to have to wait a fairly long time before their score data is sent, and if I were to make the bot public, it would very easily exceed the rate limit if the checks are done immediately after the previous one finished (I hope that made sense). Unless there's a better way of doing things, I think a get_user_best_batch would be very helpful. It would also help clean up my code quite a bit, and help scores get posted more on-time. Anyways that's my 2 cents on the issue, maybe I should open my own issue.