Nocheto HTTP API
It is ment to be a API for software developers, who wants to extend nocheto functionality. For example, you can create chess board in browser by the mans of HTML, CSS and JavaScript (as shown in example below), or browser extension which opens chess game/position from you favorite website directly in nocheto, runs analyze, get back the result and displays it.
Nocheto also provides simple HTTP server, which you can use to deliver HTML, CSS, JS and other files to the user's browser.
HTTP API is disabled by default, you need to enable it by http command.
It is available sinc version 2.4.0 as experimental feature. You need to
run nocheto with --future
option to get http command.
Available API versions
Nocheto 2.4.0 contains API version 0.1. This version is not documented, but you can download and study example v 0.1.
Nocheto 2.5.0 and newer contains API version 0.2. This version is not documented, but you can download and study example v 0.2 application, see below.
Configuration
There is a description of the [http] config section.
Section [http]2.0.0
Add the following section into your configuration file
(~/.nocheto/config/nocheto.ini
)
and the properties which default values you want to change.
[http]
port = 8080
address = "127.0.0.1"
whitelist = "new;move;flipboard;uu;redo;r;r<;r>;goto;cut;delete;branchup;loadresults;lr;hint;analyze;nag;setnag;comment;bcomment;level;seconds;autoplay;setoption;board;b;undo;u;moves;play;p;switchsounds;fen;tag;stop;speach;echo;ipv4;quit"
rootdir = "/home/<your home dir>/.nocheto/http/"
authentication = ""
requestlogfile = ""
Now you can run the http
command and open the corresponding URL
in your internet browser (for example http://127.0.0.1:8080/).
port2.0.0
port="8080"
Port number where nocheto will accept HTTP connections.
address2.0.0
address="127.0.0.1"
IP address where nocheto will accept HTTP connections.
Use 0.0.0.0 to accept from all available addresses.
whitelist2.0.0
whitelist = "new;move;flipboard;uu;redo;r;r<;r<<;r>;goto;cut;delete;branchup;loadresults;lr;hint;analyze;nag;setnag;comment;bcomment;level;seconds;autoplay;setoption;board;b;undo;u;moves;play;p;switchsounds;fen;tag;quit;stop;speach;echo"
List of allowed commands accepted by nocheto through the HTTP api.
rootdir2.0.0
rootdir = "<$HOME>/.nocheto/http/"
Root directory for files provided by nocheto through the HTTP API.
Default is the ~/.nocheto/http/
directory.
authentication3.0.0
authentication = ""
Http authentication in base64 encoding.
Default value is bm9jaGV0bzpub2NoZXRv
(=base64('nocheto:nocheto'))
requestlogfile3.0.0
requestlogfile=""
Path to a file where nocheto will log HTTP requests (if set).
Example v 0.12.4.0
Download: http_0.1.zip.
Installation
Unpack the zip archive and move the http/
directory into ~/.nocheto/
directory.
Example v 0.22.5.0
Download: http_0.2.zip.
Installation
Unpack the zip archive and move the http/
directory into ~/.nocheto/
directory.