aboutsummaryrefslogtreecommitdiff
path: root/api.md
blob: acae57565babde85033706e30ae65c51ed0aaf78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Jellything API

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 `jellyclient` crate already implements most API functionality. The
`jellycommon` crate provides useful structs for deserializing data (also
reexported in jellyclient).

```toml
# Cargo.toml
[depedencies]
jellyclient = { git = "https://codeberg.org/metamuffin/jellything.git" }
```

## GET `/api/version`

Returns API version number.

## POST `/api/create_session`

Request body contains JSON with keys `username`, `password` and `expire` (in
seconds). The Response contains the session cookie as a string in JSON.

## GET* `/n/<id>`

Request a library node (either a directory or item). See
[`common/src/api.rs`](./common/src/api.rs)

## GET* `/n/<id>/asset?<role>`

Where `role` is one of `backdrop` or `poster`. Returns assets for a node.

## GET* `/stream/<id>?tracks=<track-ids>&webm=<bool>`

Responds with the stream directly or a redirect to the actual source.