]> git.lizzy.rs Git - cheatdb.git/blob - app/flatpages/help/api.md
Add links to GitHub oauth connection settings
[cheatdb.git] / app / flatpages / help / api.md
1 title: API
2
3 ## Authentication
4
5 Not all endpoints require authentication.
6 Authentication is done using Bearer tokens:
7
8         Authorization: Bearer YOURTOKEN
9
10 You can use the `/api/whoami` to check authentication.
11
12 ## Endpoints
13
14 ### Misc
15
16 * GET `/api/whoami/` - Json dictionary with the following keys:
17         * `is_authenticated` - True on successful API authentication
18         * `username` - Username of the user authenticated as, null otherwise.
19         * 403 will be thrown on unsupported authentication type, invalid access token, or other errors.
20
21 ### Packages
22
23 * GET `/api/packages/` - See [Package Queries](#package-queries)
24 * GET `/api/packages/<username>/<name>/`
25
26 ### Releases
27
28 * GET `/api/packages/<username>/<name>/releases/`
29 * POST `/api/packages/<username>/<name>/releases/new/`
30         * Requires authentication.
31         * `title`: human-readable name of the release.
32         * `method`: Release-creation method, only `git` is supported.
33         * `min_protocol`: (Optional) minimum Minetest protocol version. See [Minetest](#minetest).
34         * `min_protocol`: (Optional) maximum Minetest protocol version. See [Minetest](#minetest).
35         * If `git` release-creation method:
36                 * `ref` - git reference, eg: `master`.
37
38
39 ### Topics
40
41 * GET `/api/topics/` - Supports [Package Queries](#package-queries), and the following two options:
42     * `show_added` - Show topics which exist as packages, default true.
43         * `show_discarded` - Show topics which have been marked as outdated, default false.
44
45 ### Minetest
46
47 * GET `/api/minetest_versions/`
48
49
50 ## Package Queries
51
52 Example:
53
54         /api/packages/?type=mod&type=game&q=mobs+fun&hide=nonfree&hide=gore
55
56 Supported query parameters:
57
58 * `type` - Package types (`mod`, `game`, `txp`).
59 * `q` - Query string
60 * `random` - When present, enable random ordering and ignore `sort`.
61 * `hide` - Hide content based on [Content Flags](content_flags).
62 * `sort` - Sort by (`name`, `views`, `date`, `score`).
63 * `order` - Sort ascending (`Asc`) or descending (`desc`).
64 * `protocol_version` - Only show packages supported by this Minetest protocol version.