Undocumented change to endpoint https://api.chess.com/pub/player/{username}/matches

Sort:
Tricky_Dicky

Stephen, believe me it was. Been using it exactly like the documented spec for at least 4 years. I parse my own endpoint returns.

stephen_33

Baffling to me.

Tricky_Dicky

It's not overly complex. This is my code for the changed endpoint


If InStr(sGames(iCount), "results"":") > 0 Then sResults = extract_string(sGames(iCount), "results"":{", "},") & "*"
If InStr(sResults, "white") > 0 Then sResWhite = extract_string(sResults, "played_as_white"":""", """")
If InStr(sResults, "black") > 0 Then sResBlack = extract_string(sResults, "played_as_black"":""", """")
Else
sResults = ""
End If


extract_string is my function for getting a sub-string between markers after checking that "results": exists in the match details.

Martin_Stahl

Staff haven't found any recent changes that should have impacted the reported issue and it's looking like the documentation will need to be updated.

Tricky_Dicky

Thanks Martin. However, somebody changed it and didn't tell anyone. Hope the spec gets updated quickly.

Martin_Stahl
Tricky_Dicky wrote:

Thanks Martin. However, somebody changed it and didn't tell anyone. Hope the spec gets updated quickly.

The site uses a code repository with version control. Code can't be changed without a record of the change happening.

Tricky_Dicky

Thanks for that Martin. But I didn't change my code which was working to the published endpoint spec until Wednesday when it failed. If I didn't change anything then somebody else did.

And the output is now different to the spec.

stephen_33

So there hasn't been any change in the fomat of the player/matches endpoint, specifically around the "results" section? The fact that my requests for those endpoints have been serviced normally without any errors or problems, suggests to me that it was correct before but Richard has seen some kind of change obviously.

But the documentation is incorrect because key-values should be contained with braces ( {} ), not brackets ( [] ).

stephen_33
Tricky_Dicky wrote:

It's not overly complex. This is my code for the changed endpoint


If InStr(sGames(iCount), "results"":") > 0 Then sResults = extract_string(sGames(iCount), "results"":{", "},") & "*"
......

I can follow that but the thing that baffles me is how my requests worked normally if the endpoint was formatted with brackets for the "results" (as shown in docs). Those indicate list items but key-values are actually being given.

That should fail for me as soon as my routine puts the downloaded string through the json parser. But who knows?

Richard, what did your code look like before you changed it?

Tricky_Dicky

Pretty much the same but with a different terminator for the search. I've overwritten the code now so can't paste it in.

Martin_Stahl
Tricky_Dicky wrote:

Thanks for that Martin. But I didn't change my code which was working to the published endpoint spec until Wednesday when it failed. If I didn't change anything then somebody else did.

And the output is now different to the spec.

I don't know if devs looked into the possibility some of the outside libraries being used may have been at fault. I believe the API and code feeding that was looked at and no changes were found there.

Tricky_Dicky

OK. Thanks. It's working for me again. Just the Doc's to update.

Martin_Stahl

Updated the documentation to change [ and ] to { and } for the match results.

Tricky_Dicky

Thanks Martin