Documentation
¶
Overview ¶
Package legacy serves etherpad-lite's HTTP API, /api/{version}/{function}, for clients written against it (Moodle, Nextcloud, WordPress plugins and the like). Calls are checked the way etherpad-lite checks them and then run by the REST API under /admin/api, so both behave the same.
Requests: GET or POST; parameters in the query string, a form body or a JSON body (body before query). Responses: {"code", "message", "data"}, where code 0 is ok, 1 a wrong parameter (HTTP 200), 2 an internal error (500), 3 no such function (404) and 4 no or wrong API key (401).
Index ¶
Constants ¶
const LatestVersion = "1.3.1"
LatestVersion is the newest API version (etherpad-lite 1.3.1).
Variables ¶
This section is empty.
Functions ¶
func APIKeyFile ¶
APIKeyFile is where etherpad-lite and earlier etherpad-go releases kept the API key. A key found there is taken over into the admin UI's keys.
func ReadAPIKeyFile ¶
ReadAPIKeyFile returns the key in path, or "" when there is no such file.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API serves the legacy HTTP API.
type Authenticator ¶
Authenticator checks a bearer token when the API key is not used.
type FileResult ¶
type FileResult int
FileResult is what ImportAPIKeyFile did.
const ( // FileNone: no file, or nothing to do. FileNone FileResult = iota // FileStored: the file's key is now a token. FileStored // FileKnown: the file's key already was a token. FileKnown // FileIgnored: the file is there, but the one take-over is done. FileIgnored )
func ImportAPIKeyFile ¶
func ImportAPIKeyFile(keys *tokens.Manager, path string) (FileResult, error)
ImportAPIKeyFile takes over the key of an APIKEY.txt as a token named "APIKEY.txt", on the first start with tokens only: the database then remembers that it was done (for every instance of a cluster), and a file found later is ignored. A failure leaves it to the next start.