Questions about developing OGS client

Hey everybody! I’m happy to join the community =)

I am creating OGS client for Ubuntu Touch(yeah, Ubuntu will be working on mobile devices soon :smiley:)
In this topic I want to ask questions that will arise in the process.

As I’m new to this, any help, advice and suggestions are very welcome)

So first I wanted to ask 2 things:

  • Are there any open source examples of interacting with OGS API?
    It would be very helpful to be able to look at some code examples.

  • How do I start a game with a bot using the API?
    I’ve found that you can challenge a player to a game like this.
    Is starting a game with a bot somewhat similar?

There aren’t any specific examples I don’t think of using the api directly but since it is a rest api the interaction is actually not too difficult. A really excellent python library to use is the requests library

http://docs.python-requests.org/en/latest/

If you want to play a bot through the api then you can challenge them directly with the link that you posted and then play out moves through the game movement which is an endpoint unto itself in the api (you can get the list of moves by running a GET request against the game directly)

If you want to write a bot, as an alternative, we have a gtp wrapper:

Good luck! I’m happy to answer any api related questions you may have… I’m always very excited to see how folks make use of the api :slight_smile:

3 Likes

Thank you very much for your reply! =)

I’ve got one more question.
I’m trying to challenge Fuego bot for a game, but it doesn’t work.
When I’m using XMLHttpRequest() it returns Status 0 and empty body.

And if I open this link in the browser:
http://online-go.com/api/v1/players/58542/challenge/
and try to send a POST request in the HTML form on that page, it returns:
Server Error (500)

Could you help me to figure out what goes wrong here?
Am I doing something wrong or is it a mistake on a server side?

Here’s the javascript code: