Browseable API... really?

Hi, sometimes I feel dumb. Here is one case.

I know that apiary (https://ogs.docs.apiary.io/#) is outdated and incomplete, though someway useful.
And I know that test queries can be done on the Django REST framework (https://online-go.com/api/). I used it many times.

What I miss is a list of all API branches.
Let’s take tournaments as an example.
Apiary contains just “List tournaments” and “Create tournament”
https://ogs.docs.apiary.io/#reference/tournaments

but I know, after some test and some post in the forum, that you can obtain also “tournament details” for a single tournament:
https://online-go.com/api/v1/tournaments/59567/

and also “tournament players”
https://online-go.com/api/v1/tournaments/59567/players

and “tournament rounds”
https://online-go.com/api/v1/tournaments/59567/rounds

The Django REST framework claims to be browseable and sometimes I find links in the result for some call. For example, “next” page in “tournament players”.
Sometimes there’s a “Related” field with some related URL (not links, just text). Just look at your personal data:
https://online-go.com/api/v1/me
You can find many other branches listed at the end of the page.

Browsing and searching on the forum I found many times said that APIs are “browseable” but I don’t really understand what that means, since for me it should be something like a tree that you can explore, but it isn’t.
Maybe is something that could be, but isn’t implemented yet. The Django documentations actually talks about browseable APIs but it seems to me that it’s up to the devs to implement such links:
https://www.django-rest-framework.org/tutorial/5-relationships-and-hyperlinked-apis/

But still I doubt that I’m missing something and there’s some simple click that can show me what I’m looking for, but haven’t found yet. Is it so?

2 Likes

References:

“Browse the rest api:”

“you can browse to our api”

“It’s even browseable:”

“note that our rest api is browseable:”

Sometimes, some nice volunteers share some knowledge in the forum, like this:

The thread is now closed, but I’m guessing if it couldn’t be a good idea to create a wiki post similar to that one, where people could add their bit and build some sort of guide and index of features.

2 Likes

There’s just a handful of users that could actually be interested in this topic but probably they didn’t even notice this thread.

Ping @flovo, @S_Alexander, who else?
Most quoted here @matburt.
I don’t know if I should bother Anoek.

I saw it but I don’t know any more than you do.

On OGS knowledge is mostly passed down from person to person like in the olden days.

If you want to create a list with all API branches, I’m in.

2 Likes

Neither do I.

I usually use the browser’s developer tools to find the API calls the website uses to retrieve the content.

Ctrl+Shift+E shows a list of all requests made by the site while the development tools are open.

4 Likes

Strg?

1 Like

Steuerung, I presume

1 Like

Ctrl+Shift+E

1 Like

I’ve also been figuring out the API using the browser dev tools. Nothing is more accurate and up to date than seeing the actual requests the website uses.

2 Likes

I tried but didn’t succeed.

I opened Chrome and it’s dev tools.
I then opened OGS site, went to a tournament page and tried ctrl+shift+e but nothing happened.
I’m very new to the devs tools so I suppose it’s my fault. Could you provide more detailed instructions please?

With chrome open, press F12 to open the dev tools. Click on the network tab and make sure the record button on the far left is started in order to see the requests. Go to a page such as https://online-go.com/tournament/62495 and you should see a bunch of requests. You can filter the requests in the search bar underneath the record button to something you’re interested in, such as “tournament”. You can click on the name of one of the requests to bring up the details of the request. The header tab on the details will show you what was sent by the requester and the preview or response tab will show you what was received back from the API. If you click around a bit in the website maybe you’ll stumble upon a new API endpoint that you didn’t know existed. I hope that helps!

1 Like

I recommend clicking XHR to filter for the API requests (XHR is short for XMLHttpRequest, how Javascript sends HTTP(S) requests on a page.)

1 Like

Thanks a lot @wolfeystudios and @polar-bear, your comments were both very helpful.

I went to a tournament page and copied all API request that I found.
I was hoping to find something about groups of players inside of tournament, but there isn’t.
I guess the look of tournament page, with arrays of players and result of their games is built with code.

image

These were the source of all tournament data:
https://online-go.com/api/v1/tournaments/38088/players/all
https://online-go.com/api/v1/tournaments/38088/rounds

1 Like