Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedding records data #42

Closed
blha303 opened this issue Jan 24, 2017 · 3 comments
Closed

Embedding records data #42

blha303 opened this issue Jan 24, 2017 · 3 comments
Milestone

Comments

@blha303
Copy link

blha303 commented Jan 24, 2017

It would be extremely handy to be able to embed data like records that's accessible from a resource. By that I mean, if you can access /games/<id>/records, being able to embed records data would save an API request and the time associated with it. It would also simplify the problem I'm having with https://github.com/blha303/srcomapi where requesting the records data as a class attribute is causing some issues; if the data was in the request to start with there would be no issues.

Overall the embed feature could be expanded to support more data types, although I'm unaware of the impact this would have on the database, obviously it's up to the owners of speedrun.com but doing a join in a database query is faster than making multiple API requests and joining them on the other end.

@Lighnat0r
Copy link
Contributor

Improving how using /records works is on my to-do list.
Could you provide specific example request(s) that you'd want to work but doesn't (or doesn't work the way you want) since I'm not completely sure what you're after, and I'd rather not go digging through your code to find out where you're having issues.

@Lighnat0r Lighnat0r added this to the v2 milestone Jan 24, 2017
@blha303
Copy link
Author

blha303 commented Jan 24, 2017

Without using embeds, it takes three requests to get the current world record for a category in a game. I'm retrieving information for the GDQ vod thread so I have to look up the correct category and then retrieve records for it. A request to /games to get the url for category information, a request to /games/id/categories for the list of categories, and then a request to /categories/id/records to get the world record. With embeds it takes two requests, a request to /games?embed=categories and then using the /records url from the embedded results.

Ideally, I would be able to embed information for records (and other information available at sublevels like variables [variables is already supported as an embed, imo it's weird that records isn't haha]) in the category results with ?embed=categories.records, maybe also via ?embed=records but then there's the issue of it not being specific to the desired category. Then again, most of the time I'd imagine users are likely to want the any% record.

@Judas
Copy link

Judas commented Apr 25, 2017

👍 on this. I'm making an Android app from this API and I would gladly have to get the records directly embedded in a single /runs?embed=category.records,level.records request.
Right now it takes 2 requests for that (request the runs with their level/categories then request the level/category for its records).

@blha303 blha303 closed this as completed Aug 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants