Hi, I was trying to identify the api used during a game on a demo board but couldn’t find any calls. Nothing new was in the web socket when I make a move and nothing new went in the Fetch/XHR tab. Am I missing something?
I think I found it. It’s under the developer tool > Network > Messages.
Although for some reason there are multiple
?EIO=4&transport=websocket under name and Messages only one of them corresponds to the playing moves.
Actually if someone could help me with this, how do I understand the highlighted section?
Why is the message so weird looking?
I think OGS API notes has the answer to my question, although I can’t understand which part of the message refers to the coordinate info.
"m" has the coordinates (see my screenshot in your other thread)
Those are SGF style coords, so “abcdef” = 1-2, 3-4, 5-6
Can I understand the up arrow to mean the client uploading information to the server through the socket? And do I need all of f, k, m, t and ts to make a new move? What are all these values? The real time api doc doesn’t seem to cover these.
Here’s some basic info I could find:
"f" /* from (move) */, "m" /* moves */, "om" /* offical move [reviewing live game] */, "undo" /* offical undo [reviewing live game] */, "t" /* text */, "t+" /* text append */, "k" /* marks */, "pp" /* pen point */, "pen" /* pen color */,
I’ll try to dig up what happens if you don’t supply these.
As far as I can see, f k m t appear optional.
What’s actually going on is not immediately intuitive to me. I suspect that a person using this API needs a primer on how reviews work: I have access to the relevant code, but I can’t fully understand its intent.
There appears to be a review concept called an “entry”.
If you supply one or more of f k m t, then you are “updating the last entry” with the data you provide.
However, if you don’t provide any of f k m t , then you are “adding a new entry”.
The difference appears to be that “adding a new entry” creates a record with a new “id”, wheras “updating the last entry” creates another record with the same id as the previous one (or a new one if there isn’t a previous one).
Does this correlate with the way you see the API operating?
Extra detail: if you want t to do anything, you need to also supply m and f.
Full disclosure: I haven’t read “API notes”, so maybe this information combined with whatever’s in there would help you?
… is this a “typo” kind of thing? I can’t see ts in your screenshot or the API itself, on the inbound side
On the response, ts corresponds to the “id” of the entry (as it happens, the unique id of “review entries” is the timestamp of them).
Sorry if this doesn’t actually help much Best I can do with what I have.
Thanks for the explanation. This helps a lot! So if I want to keep playing on the same board, I guess I need to supply f and m? Not sure if that’s correct. Also, to do everything programmatically, including logging in, creating a game and playing the game, what are needed to let the server know that I am playing on a specific game?
As I understand it, you need that socket open, and authentication and authorisation flows from that.
Each action relating to a game/review has the id of the target in it - that’s how you “let the server know” about that.
If you (authenticated on socket connection) are allowed to mess with the game of the id you supplied, then you’ll be allowed to, and if you aren’t you won’t.
To be honest, I think you might need to experiment or reverse engineer - either look at the logs for when the web client does and does not supply them, and/or try with and without to see what it means to “create” or “update” an entry … this is territory I can’t readily figure out.
@GreenAsJade thank you! I really appreciate your help and explanation! Time for me to play with the API again.