Operations

8TML > Reference > Publishing API

Parameters in brackets are only sent on the signed route.

status

GET url?op=status, no key needed. Tells the client what the endpoint offers:

status: ok
api: 1
auth: hmac https
max-size: 16384

auth lists the routes the endpoint accepts: hmac for signed requests, https for requests over HTTPS. max-size is the largest file in bytes.

challenge

POST url?op=challenge&id=ID with an empty body and no signature. Only signed requests need it:

status: ok
challenge: 9b1c0e5d2f7a4468b03e51c6d8a7f210
expires: 120

A challenge is 16 random bytes as 32 lowercase hexadecimal digits. It is valid for expires seconds and for one request only: the endpoint uses it up when a request names it, whether that request succeeds or not.

put

POST url?op=put&id=ID&name=NAME&size=N[&c=CHALLENGE] with the N bytes of the file as the body. Creates the file or replaces it:

status: ok
name: news.8tml
size: 1874
url: http://example.com/news.8tml
warning: line 12: non-ASCII characters changed to ASCII

size is the stored size, which differs from N when the endpoint converts text. url is the file’s public address. Any number of warning lines may follow.

delete

POST url?op=delete&id=ID&name=NAME&size=0[&c=CHALLENGE], no content. Removes the file. A name of a type the endpoint doesn’t accept is answered with bad-type (see Endpoint rules).

list

POST url?op=list&id=ID&size=0[&c=CHALLENGE], no content. Lists every file of the site that the API manages (see Endpoint rules), sorted by name, one file line each with its size and name:

status: ok
count: 3
file: 1874 index.8tml
file: 912 news.8tml
file: 240 plot.8ss