What are your thoughts about GraphQL language for APIs for chess.com

Sort:
me_learning

Is GraphQL language for APIs ever used when it comes to chess website

https://graphql.org/

Would this help ever with API when solving 

I'm curious what you think of GraphQL

What are your thoughts about GraphQL language for APIs for chess.com 

Tricky_Dicky

Can you make it a bit bigger. I can't  read it if I'm more than half a mile away.

stephen_33

Perhaps me_learning is shouting to get attention?  😄

But to address the question, I've asked much the same in the past about being able to filter endpoint data but the answer that usually comes back is that endpoints are cached, so it's a case of returning the entire set of data or none.

I often need only the few 'open' (in registration) matches for a club but the endpoint includes all the matches ever played by the club & that can be a very large set of data. Being able to filter what's wanted would be useful but I don't see the site changing the API.

Tricky_Dicky

I have routines to parse the data string returned in order to extract the individual data items

stephen_33

That isn't a problem exactly, it's just that I find myself downloading some very large endpoints when I need only a tiny amount of data from them. And of course downloading all that redundant data takes finite time, slowing down any process that uses a lot of them.

As much as anything, might it not ease some of the pressure on the servers if transfer-file sizes were greatly reduced?

Williamfwm

FYI you can have GraphQL query over a set of rest APIs instead of e.g. a database. I recall reading that in the GraphQL docs as a migration strategy.

Here's an example I found: https://graphql.org/blog/rest-api-graphql-wrapper/

Look like you just have your resolvers hit the REST endpoints (plus some caching help for re-fetches of the same endpoint with same params)

Won't magically stop your server from making multiple calls but it could make your life easier as a consumer of the data.

lawnpawnfawn

I think cached endpoints like stephen_33 says would make graphQL endpoints tricky, but also like the idea of params around them, unfortunate, but makes sense why they wouldn't enable that for their public API.

I think Williamfwm is on to something with the rest graphQL wrapper, it would likely be very easy to implement some URL params that way instead of requesting the fine folks at chess.com change their entire API.

stephen_33

I like to think that the developers here took most of those points into consideration when designing the chess.com API. Less than perfect as it is, it's still an immensely useful resource!