aboutsummaryrefslogtreecommitdiff
path: root/api.md
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-08-05 11:58:01 +0200
committermetamuffin <metamuffin@disroot.org>2023-08-05 11:58:01 +0200
commitabb8e4a10f0ac0a8c0a652efe8b0efc0da59c46e (patch)
tree7764beafda65936e87ae0315d912c833c97ea944 /api.md
parent7cba183debcf2cefd90b4c1e7a630fb0c2152d06 (diff)
downloadjellything-abb8e4a10f0ac0a8c0a652efe8b0efc0da59c46e.tar
jellything-abb8e4a10f0ac0a8c0a652efe8b0efc0da59c46e.tar.bz2
jellything-abb8e4a10f0ac0a8c0a652efe8b0efc0da59c46e.tar.zst
update api.md
Diffstat (limited to 'api.md')
-rw-r--r--api.md28
1 files changed, 16 insertions, 12 deletions
diff --git a/api.md b/api.md
index 8fac72c..acae575 100644
--- a/api.md
+++ b/api.md
@@ -1,34 +1,38 @@
# Jellything API
-Routes marked with `*` require authentification. Any endpoint returning JSON,
-will report errors with an object containing error string in the `error` key.
+Most endpoints require the `Accept` header to be present and set to
+`application/json`. Any endpoint returning JSON, will report errors with an
+object containing error string in the `error` key. Routes marked with `*`
+require authentification.
-The `jellycommon` crate provides useful structs for deserializing data.
+The `jellyclient` crate already implements most API functionality. The
+`jellycommon` crate provides useful structs for deserializing data (also
+reexported in jellyclient).
```toml
# Cargo.toml
[depedencies]
-jellycommon = { git = "https://codeberg.org/metamuffin/jellything.git" }
+jellyclient = { git = "https://codeberg.org/metamuffin/jellything.git" }
```
## GET `/api/version`
Returns API version number.
-## POST `/api/account/login`
+## POST `/api/create_session`
-Request body contains JSON with keys `username` and `password`. The Response
-contains the session cookie.
+Request body contains JSON with keys `username`, `password` and `expire` (in
+seconds). The Response contains the session cookie as a string in JSON.
-## GET* `/api/node/<path...>`
+## GET* `/n/<id>`
Request a library node (either a directory or item). See
[`common/src/api.rs`](./common/src/api.rs)
-## GET* `/api/assets/node/<path..>?<role>`
+## GET* `/n/<id>/asset?<role>`
-Where `role` is one of `Backdrop` or `Poster`. Returns assets for a node.
+Where `role` is one of `backdrop` or `poster`. Returns assets for a node.
-## GET* `/stream/<path..>?tracks=<track-ids>&webm=<bool>`
+## GET* `/stream/<id>?tracks=<track-ids>&webm=<bool>`
-Responds with the stream.
+Responds with the stream directly or a redirect to the actual source.