Jocly Webmaster API

Jocly Webmaster API

 

The webmaster API allows Jocly services to be used from another web site. The Jocly server provides a number of URLs for doing so.

The requests require a webmaster id to be included into the server API URL. The webmaster id can be obtained from the user account on the Jocly site.

Playing the game

The actual game integration is performed as an iframe with “src” attribute set to:

http://www.jocly.com/jocly/wapi/{webmaster id}/play-game/{game name}

{game name} is the machine name for the game to be played (check http://www.jocly.com/jocly/wapi/show-games for a list of available games).

Some parameters can be added to this URL to control the behavior:

level: the default level, value is to be taken from the get-game method (see below).

start: one of the following strings:

dont-mind: the first player is chosen randomly

i-start: the user starts playing

other-starts: the computer starts playing

autostart: by default, the iframe displays a screen where the user can choose the level and the starting options before the game actually starts. If autostart is set to true, the game starts immediately.

For instance, the following HTML fragment displays a checkers games, size 400x400, user starts immediately at first level:

<iframe src="http://www.jocly.com/jocly/wapi/{webmaster id}/play-game/draughts?autostart=true&level=0&start=i-start" width="400" height="400" frameborder="0"></iframe>

List available games

Information about the games can be obtained as a JSON array of game descriptor objects including the game machine and human names, the URL to get the thumbnail image, and the link for the iframe source.

http://www.jocly.com/jocly/wapi/{webmaster id}/list-games

Get game details

Information about the available levels is available.

http://www.jocly.com/jocly/wapi/{webmaster id}/get-game/{game name}

List available languages

Returns the list of available languages on the Jocly platform (currently 'en' and 'fr') as a JSON array.

http://www.jocly.com/jocly/wapi/{webmaster id}/get-langs

Set language

Normally, Jocly considers the browser current locale and displays the game user interface accordingly. However, it is possible to force the language setting to match a user preference if any. The language setting affects the game application user interface. The game itself may not offer the requested locale (for instance, the rules may only be available in English).

http://www.jocly.com/jocly/wapi/{webmaster id}/set-lang/{language}

It is possible to unset a previously set language. The user interface will then display using the automatic locale detection.

http://www.jocly.com/jocly/wapi/{webmaster id}/unset-lang