Requests and replies

8TML > Reference > Publishing API

Requests

  • The request goes to the endpoint’s url with these parameters in the query string: op (the operation), id (the key’s id) and, depending on the operation, name, size and c (the challenge).
  • status is sent with GET. Every other operation is sent with POST, which no proxy caches and no client repeats by itself.
  • Headers: Host: always; on POST, Content-Length:, also when it is 0; Authorization: only over HTTPS. The endpoint ignores the request’s Content-Type:.
  • The body of a POST is the file’s content, if the operation has one, followed by the 64-digit signature on the signed route.

Through an HTTPS proxy, the request line carries the full address:

POST https://example.com/publish?op=list&id=anna-1 HTTP/1.0

Replies

  • The HTTP status is 200 on success, 4xx or 5xx on errors.
  • The body is text/plain ASCII with LF line endings: key: value lines, keys in lowercase, no line longer than 255 characters.
  • The first line is status: ok or status: error. Clients read the reply line by line and ignore keys they don’t know.
  • An error reply has error: with one of the codes below and message: with a short text for the user.
status: error
error: too-large
message: Files can be at most 16384 bytes.

Error codes

Code HTTP Meaning
bad-request 400 a missing or malformed parameter, a wrong Content-Length
bad-name 400 the file name breaks the rules
bad-type 415 the endpoint doesn’t accept this kind of file
invalid 422 the endpoint refused the content
auth 403 an unknown or revoked key, a wrong signature
expired 403 an unknown, used or expired challenge
insecure-key 403 a key was sent over plain HTTP, which is unsafe
not-found 404 no such file
too-large 413 the file is larger than max-size
quota 507 the site is full
busy 429 too many requests; try again later
server 500 anything else