From 421d869e00a200ab08b8513ebe93d8452f13c54b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zlatko=20=C4=8Calu=C5=A1i=C4=87?= Date: Tue, 27 Dec 2016 16:37:59 +0100 Subject: [PATCH] Add REST_backend.md --- doc/REST_backend.md | 61 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 doc/REST_backend.md diff --git a/doc/REST_backend.md b/doc/REST_backend.md new file mode 100644 index 0000000..1769983 --- /dev/null +++ b/doc/REST_backend.md @@ -0,0 +1,61 @@ +Original location of this document: https://github.com/restic/restic/blob/master/doc/REST_backend.md + +REST Backend +============ + +Restic can interact with HTTP Backend that respects the following REST API. The +following values are valid for `{type}`: `data`, `keys`, `locks`, `snapshots`, +`index`, `config`. `{path}` is a path to the repository, so that multiple +different repositories can be accessed. The default path is `/`. + +## HEAD {path}/config + +Returns "200 OK" if the repository has a configuration, +an HTTP error otherwise. + +## GET {path}/config + +Returns the content of the configuration file if the repository has a configuration, +an HTTP error otherwise. + +Response format: binary/octet-stream + +## POST {path}/config + +Returns "200 OK" if the configuration of the request body has been saved, +an HTTP error otherwise. + +## GET {path}/{type}/ + +Returns a JSON array containing the names of all the blobs stored for a given type. + +Response format: JSON + +## HEAD {path}/{type}/{name} + +Returns "200 OK" if the blob with the given name and type is stored in the repository, +"404 not found" otherwise. If the blob exists, the HTTP header `Content-Length` +is set to the file size. + +## GET {path}/{type}/{name} + +Returns the content of the blob with the given name and type if it is stored in the repository, +"404 not found" otherwise. + +If the request specifies a partial read with a Range header field, +then the status code of the response is 206 instead of 200 +and the response only contains the specified range. + +Response format: binary/octet-stream + +## POST {path}/{type}/{name} + +Saves the content of the request body as a blob with the given name and type, +an HTTP error otherwise. + +Request format: binary/octet-stream + +## DELETE {path}/{type}/{name} + +Returns "200 OK" if the blob with the given name and type has been deleted from the repository, +an HTTP error otherwise.