From abb8e4a10f0ac0a8c0a652efe8b0efc0da59c46e Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 5 Aug 2023 11:58:01 +0200 Subject: update api.md --- api.md | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'api.md') 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/` +## GET* `/n/` Request a library node (either a directory or item). See [`common/src/api.rs`](./common/src/api.rs) -## GET* `/api/assets/node/?` +## GET* `/n//asset?` -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/?tracks=&webm=` +## GET* `/stream/?tracks=&webm=` -Responds with the stream. +Responds with the stream directly or a redirect to the actual source. -- cgit v1.2.3-70-g09d2