ppy / osu-web

the browser-facing portion of osu!
https://osu.ppy.sh
GNU Affero General Public License v3.0
981 stars 384 forks source link

osu!api v2 - Getting all modes ranks #8020

Closed 10YAR closed 3 years ago

10YAR commented 3 years ago

Hello,

I'm writing this issue because of a problem I have on the osu!api v2, my webpage takes 2 seconds to show, and it's due to the fact that I'm doing 4 curls in order to get each modes ranks of a user :

$user = curl($osuApiUser . "/osu", null, $fallbackToken); $mania = curl($osuApiUse . "/mania", null, $fallbackToken); $taiko = curl($osuApiUser . "/taiko", null, $fallbackToken); $ctb = curl($osuApiUser . "/fruits", null, $fallbackToken);

I'd like to know if there's a better way to get ranks of all modes. If not, is it possible to add a "all_gamemodes" option in the api ?

Thanks!

frenzibyte commented 3 years ago

You can get ranks of all mods by querying osu.ppy.sh/api/v2/users?ids[]={user_id}, which would include all gamemodes/rulesets and the user's statistics for each (statistics_rulesets).

However, there was a proposal osu!lazer-side about a feature which can only be possible to implement by either including the statistics_rulesets object in the api/v2/user/{user_id} endpoint, or requerying using the user compact endpoint to get that object.

I'm interested in hearing whether it'll be feasible to include the full statistics_rulesets object in the api/v2/user/{user_id} endpoint as well, as that'll be useful to determine the user's rank without having to requery.

10YAR commented 3 years ago

Seems like it doesn't work

I requested this URL : https://osu.ppy.sh/api/v2/users?ids[]=2892140

And i'm getting this error : array(1) { ["error"]=> string(26) "Invalid scope(s) provided." }

While I have these scopes : image

tybug commented 3 years ago

The /v2/users endpoint is lazer only and not available to standard oauth applications.

10YAR commented 3 years ago

I see, so there are no ways to get all gamemodes right now ?

peppy commented 3 years ago

I think these days we are already querying this data regardless, and it could potentially just be included in the transformer?

nanaya commented 3 years ago

Those are from different table for each modes and only the relevant one is queried.

peppy commented 3 years ago

Ah, I was thinking of lazer getting all of these for difficulty recommendations. It turns out we also just query four times).

Going to close this for now I think.