Here's an odd thing!

Sort:
stephen_33

I'm trying to collate the results for the first stage of this year's TMCL tournament but I keep hitting a small snag with the following club that's taking part...

https://www.chess.com/club/the-empire-of-assassins


The club name appears to be as it's displayed: "The Empire Of Assassins"

No extra spaces or odd characters but my program crashed (as I prefer it to) because  the spelling of the name in the club's matches is different from the one I have in my input file. For example...

https://api.chess.com/pub/match/1209620

"name":"The Empire Of  Assassins"

Note the double-space between Of and Assassins! Simple I thought, I'll ask the club SA to edit the club name to remove the superfluous space. They did that but the name given in this and another match remained the same.

Interestingly here...

https://api.chess.com/pub/club/the-empire-of-assassins

"name":"The Empire Of Assassins"

The name is given without the extra space but why is the club name different between different endpoints?

Without an immutable reference for a club by which an endpoint might be accessed, the task of processing club-related data is difficult enough (some admins just love changing their club's name) but if the name itself isn't held consistently between endpoints, the job becomes a lot harder.

stephen_33

This may have been a lag problem in that the servers took some time to update all the club's match details because it looks as if it's been corrected now.

Nevfy

Probably, you get name of the club from a wrong place.

In mentioned match ( https://api.chess.com/pub/match/1209620 ) the club has two spaces in the match's name jsn['name'] = "TMCL 2021 B3 R3 Art Of Chess vs The Empire Of  Assassins", but it has correct style in jsn['teams']['team2']['name'] = "The Empire Of Assassins".

Nevertheless, I think it could be better to use club's ID as immutable reference in scripts, which is always "the-empire-of-assassins".

Martin_Stahl
stephen_33 wrote:

This may have been a lag problem in that the servers took some time to update all the club's match details because it looks as if it's been corrected now.

 

That's probably the case. I believe the endpoints are periodically updated; the data isn't live data.

stephen_33
Nevfy wrote:

Probably, you get name of the club from a wrong place.

In mentioned match ( https://api.chess.com/pub/match/1209620 ) the club has two spaces in the match's name jsn['name'] = "TMCL 2021 B3 R3 Art Of Chess vs The Empire Of  Assassins", but it has correct style in jsn['teams']['team2']['name'] = "The Empire Of Assassins".

Nevertheless, I think it could be better to use club's ID as immutable reference in scripts, which is always "the-empire-of-assassins".

Arguably yes but not for the reason you give. I certainly don't copy it from a club's match name, I copy it from the club name on the profile page. The problem with doing that is that any extra spaces are removed by the browser (I believe), so you don't necessarily capture every character.

I did have a similar problem a few years ago and it was one of the developers who told me the official club name is to be found reliably in the club's stats endpoint. Copying & pasting from the profile page works perfectly well the great majority of the time but in this case not.

Having access to an unchanging reference such as a club's ID is very much what many of us want but there's no way of at present of converting it into a club's name.

Nevfy

I was just trying to make an assumption based on the given information. You said that you receive club's name with double space from match's endpoint, so I checked the endpoint and saw double space there only in one place. As you explained later, match's endpoint was not yet updated when you checked it, but was already updated when I checked it. happy.png

Speaking about "...there's no way of at present of converting it [club's ID] into a club's name". You can easily convert club's ID into club's name demanding related endpoint. For example, you know that stable ID for the club is "the-empire-of-assassins", so you request JSON ( https://api.chess.com/pub/club/the-empire-of-assassins ) and get field "name" from there. There is a problem with automatic back side conversion, but I never need it. In my scripts I always operate with club's ID and only convert them into club's name at the stage of output for beauty. If it suits you, maybe, you can catch up the same style of working with clubs.

stephen_33

"You can easily convert club's ID into club's name demanding related endpoint"

No, you've misunderstood what I meant. The club ID I was referring to is this one...

Example: https://api.chess.com/pub/club/levice

"name":"Levice","club_id":12700,"coun

That's the ID I had in mind, not the club's url ID which changes as the club name changes.

Nevfy

Oh, now I see what you meant. Thanks. Yeah, unfortunately, we can't easily work with such ID for the club as well as with analogical player's immutable ID.