2019-11-22 15:33:22 +01:00
|
|
|
title: API
|
|
|
|
|
2021-11-25 11:49:31 +01:00
|
|
|
|
|
|
|
## Resources
|
|
|
|
|
|
|
|
* [How the Minetest client uses the API](https://github.com/minetest/contentdb/blob/master/docs/minetest_client.md)
|
|
|
|
|
|
|
|
|
2021-02-02 23:47:46 +01:00
|
|
|
## Responses and Error Handling
|
|
|
|
|
2023-04-19 19:27:28 +02:00
|
|
|
If there is an error, the response will be JSON similar to the following with a non-200 status code:
|
2021-02-02 23:47:46 +01:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"success": false,
|
|
|
|
"error": "The error message"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Successful GET requests will return the resource's information directly as a JSON response.
|
|
|
|
|
|
|
|
Other successful results will return a dictionary with `success` equaling true, and
|
2021-02-27 19:31:56 +01:00
|
|
|
often other keys with information. For example:
|
|
|
|
|
|
|
|
```js
|
|
|
|
{
|
|
|
|
"success": true,
|
|
|
|
"release": {
|
2023-04-19 19:27:28 +02:00
|
|
|
/* same as returned by a GET */
|
2021-02-27 19:31:56 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
2021-02-02 23:47:46 +01:00
|
|
|
|
|
|
|
|
2022-01-12 18:08:18 +01:00
|
|
|
### Paginated Results
|
|
|
|
|
|
|
|
Some API endpoints returns results in pages. The page number is specified using the `page` query argument, and
|
|
|
|
the number of items is specified using `num`
|
|
|
|
|
|
|
|
The response will be a dictionary with the following keys:
|
|
|
|
|
2023-04-19 19:27:28 +02:00
|
|
|
* `page`: page number, integer from 1 to max
|
2022-01-12 18:08:18 +01:00
|
|
|
* `per_page`: number of items per page, same as `n`
|
|
|
|
* `page_count`: number of pages
|
|
|
|
* `total`: total number of results
|
|
|
|
* `urls`: dictionary containing
|
|
|
|
* `next`: url to next page
|
|
|
|
* `previous`: url to previous page
|
|
|
|
* `items`: array of items
|
|
|
|
|
|
|
|
|
2019-11-22 15:33:22 +01:00
|
|
|
## Authentication
|
|
|
|
|
2021-02-02 23:47:46 +01:00
|
|
|
Not all endpoints require authentication, but it is done using Bearer tokens:
|
2019-11-22 15:33:22 +01:00
|
|
|
|
2021-02-02 18:09:19 +01:00
|
|
|
```bash
|
2021-02-02 23:47:46 +01:00
|
|
|
curl https://content.minetest.net/api/whoami/ \
|
2023-04-19 19:27:28 +02:00
|
|
|
-H "Authorization: Bearer YOURTOKEN"
|
2021-02-02 18:09:19 +01:00
|
|
|
```
|
2019-11-22 15:33:22 +01:00
|
|
|
|
2021-02-02 18:09:19 +01:00
|
|
|
Tokens can be attained by visiting [Settings > API Tokens](/user/tokens/).
|
2020-05-19 18:24:57 +02:00
|
|
|
|
2021-02-02 23:41:48 +01:00
|
|
|
* GET `/api/whoami/`: JSON dictionary with the following keys:
|
|
|
|
* `is_authenticated`: True on successful API authentication
|
|
|
|
* `username`: Username of the user authenticated as, null otherwise.
|
2021-02-02 18:09:25 +01:00
|
|
|
* 4xx status codes will be thrown on unsupported authentication type, invalid access token, or other errors.
|
2023-10-31 19:46:34 +01:00
|
|
|
* DELETE `/api/delete-token/`: Deletes the currently used token.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# Logout
|
|
|
|
curl -X DELETE https://content.minetest.net/api/delete-token/ \
|
|
|
|
-H "Authorization: Bearer YOURTOKEN"
|
|
|
|
```
|
2019-11-22 15:33:22 +01:00
|
|
|
|
2021-02-02 23:41:48 +01:00
|
|
|
|
2021-02-02 21:05:24 +01:00
|
|
|
## Packages
|
2019-11-22 15:33:22 +01:00
|
|
|
|
2021-02-02 22:35:29 +01:00
|
|
|
* GET `/api/packages/` (List)
|
|
|
|
* See [Package Queries](#package-queries)
|
|
|
|
* GET `/api/packages/<username>/<name>/` (Read)
|
|
|
|
* PUT `/api/packages/<author>/<name>/` (Update)
|
2021-02-03 13:50:16 +01:00
|
|
|
* Requires authentication.
|
2021-02-02 23:47:46 +01:00
|
|
|
* JSON dictionary with any of these keys (all are optional, null to delete Nullables):
|
|
|
|
* `type`: One of `GAME`, `MOD`, `TXP`.
|
2021-02-02 22:35:29 +01:00
|
|
|
* `title`: Human-readable title.
|
2021-02-02 23:47:46 +01:00
|
|
|
* `name`: Technical name (needs permission if already approved).
|
2021-02-02 23:34:51 +01:00
|
|
|
* `short_description`
|
2021-12-20 22:07:12 +01:00
|
|
|
* `dev_state`: One of `WIP`, `BETA`, `ACTIVELY_DEVELOPED`, `MAINTENANCE_ONLY`, `AS_IS`, `DEPRECATED`,
|
|
|
|
`LOOKING_FOR_MAINTAINER`.
|
2021-02-05 16:29:44 +01:00
|
|
|
* `tags`: List of [tag](#tags) names.
|
|
|
|
* `content_warnings`: List of [content warning](#content-warnings) names.
|
|
|
|
* `license`: A [license](#licenses) name.
|
2023-04-19 19:27:28 +02:00
|
|
|
* `media_license`: A [license](#licenses) name.
|
2021-02-03 01:11:48 +01:00
|
|
|
* `long_description`: Long markdown description.
|
2023-11-19 14:39:38 +01:00
|
|
|
* `repo`: Source repository (eg: Git)
|
2021-02-02 22:35:29 +01:00
|
|
|
* `website`: Website URL.
|
|
|
|
* `issue_tracker`: Issue tracker URL.
|
2021-02-02 23:47:46 +01:00
|
|
|
* `forums`: forum topic ID.
|
2022-01-25 23:13:48 +01:00
|
|
|
* `video_url`: URL to a video.
|
2023-03-05 19:13:07 +01:00
|
|
|
* `donate_url`: URL to a donation page.
|
2024-02-25 19:05:29 +01:00
|
|
|
* `translation_url`: URL to send users interested in translating your package.
|
2022-02-02 02:11:44 +01:00
|
|
|
* `game_support`: Array of game support information objects. Not currently documented, as subject to change.
|
2024-04-01 18:32:12 +02:00
|
|
|
* GET `/api/packages/<username>/<name>/for-client/`
|
|
|
|
* Similar to the read endpoint, but optimised for the Minetest client
|
|
|
|
* `long_description` is given as a hypertext object, see `/hypertext/` below.
|
|
|
|
* `info_hypertext` is the info sidebar as a hypertext object.
|
|
|
|
* Query arguments
|
|
|
|
* `formspec_version`: Required. See /hypertext/ below.
|
2024-04-05 19:17:07 +02:00
|
|
|
* `include_images`: Optional, defaults to true. If true, images use `<img>`. If false, they're linked.
|
2024-04-01 18:32:12 +02:00
|
|
|
* `protocol_version`: Optional, used to get the correct release.
|
|
|
|
* `engine_version`: Optional, used to get the correct release. Ex: `5.3.0`.
|
2023-04-19 19:27:28 +02:00
|
|
|
* GET `/api/packages/<author>/<name>/hypertext/`
|
|
|
|
* Converts the long description to [Minetest Markup Language](https://github.com/minetest/minetest/blob/master/doc/lua_api.md#markup-language)
|
|
|
|
to be used in a `hypertext` formspec element.
|
|
|
|
* Query arguments:
|
|
|
|
* `formspec_version`: Required, maximum supported formspec version.
|
2024-04-05 19:17:07 +02:00
|
|
|
* `include_images`: Optional, defaults to true. If true, images use `<img>`. If false, they're linked.
|
2023-04-19 19:27:28 +02:00
|
|
|
* Returns JSON dictionary with following key:
|
|
|
|
* `head`: markup for suggested styling and custom tags, prepend to the body before displaying.
|
|
|
|
* `body`: markup for long description.
|
|
|
|
* `links`: dictionary of anchor name to link URL.
|
|
|
|
* `images`: dictionary of img name to image URL
|
|
|
|
* `image_tooltips`: dictionary of img name to tooltip text.
|
2020-06-05 05:48:53 +02:00
|
|
|
* GET `/api/packages/<username>/<name>/dependencies/`
|
2023-04-19 19:27:28 +02:00
|
|
|
* Returns dependencies, with suggested candidates
|
2021-02-02 18:09:25 +01:00
|
|
|
* If query argument `only_hard` is present, only hard deps will be returned.
|
2022-01-12 18:08:18 +01:00
|
|
|
* GET `/api/dependencies/`
|
|
|
|
* Returns `provides` and raw dependencies for all packages.
|
|
|
|
* Supports [Package Queries](#package-queries)
|
2022-01-12 21:50:01 +01:00
|
|
|
* [Paginated result](#paginated-results), max 300 results per page
|
2022-01-12 18:08:18 +01:00
|
|
|
* Each item in `items` will be a dictionary with the following keys:
|
2023-04-19 19:27:28 +02:00
|
|
|
* `type`: One of `GAME`, `MOD`, `TXP`.
|
2022-01-12 18:08:18 +01:00
|
|
|
* `author`: Username of the package author.
|
|
|
|
* `name`: Package name.
|
|
|
|
* `provides`: List of technical mod names inside the package.
|
|
|
|
* `depends`: List of hard dependencies.
|
2022-09-01 23:45:53 +02:00
|
|
|
* Each dep will either be a modname dependency (`name`), or a
|
2022-01-12 18:08:18 +01:00
|
|
|
package dependency (`author/name`).
|
|
|
|
* `optional_depends`: list of optional dependencies
|
|
|
|
* Same as above.
|
2022-11-06 11:32:46 +01:00
|
|
|
* GET `/api/packages/<username>/<name>/stats/`
|
|
|
|
* Returns daily stats for package, or null if there is no data.
|
2022-11-09 19:46:11 +01:00
|
|
|
* Daily date is done based on the UTC timezone.
|
2022-11-06 11:32:46 +01:00
|
|
|
* EXPERIMENTAL. This API may change without warning.
|
2023-06-14 23:47:08 +02:00
|
|
|
* Query args:
|
|
|
|
* `start`: start date, inclusive. Optional. Default: 2022-10-01. UTC.
|
|
|
|
* `end`: end date, inclusive. Optional. Default: today. UTC.
|
2022-11-15 02:51:21 +01:00
|
|
|
* An object with the following keys:
|
2023-06-14 23:47:08 +02:00
|
|
|
* `start`: start date, inclusive. Ex: 2022-10-22. M
|
2022-11-09 19:46:11 +01:00
|
|
|
* `end`: end date, inclusive. Ex: 2022-11-05.
|
|
|
|
* `platform_minetest`: list of integers per day.
|
|
|
|
* `platform_other`: list of integers per day.
|
|
|
|
* `reason_new`: list of integers per day.
|
|
|
|
* `reason_dependency`: list of integers per day.
|
|
|
|
* `reason_update`: list of integers per day.
|
2022-11-15 02:51:21 +01:00
|
|
|
* GET `/api/package_stats/`
|
|
|
|
* Returns last 30 days of daily stats for _all_ packages.
|
|
|
|
* An object with the following keys:
|
|
|
|
* `start`: start date, inclusive. Ex: 2022-10-22.
|
|
|
|
* `end`: end date, inclusive. Ex: 2022-11-05.
|
|
|
|
* `package_downloads`: map from package key to list of download integers.
|
2019-11-22 15:33:22 +01:00
|
|
|
|
2021-11-25 11:49:31 +01:00
|
|
|
You can download a package by building one of the two URLs:
|
|
|
|
|
|
|
|
```
|
|
|
|
https://content.minetest.net/packages/${author}/${name}/download/`
|
|
|
|
https://content.minetest.net/packages/${author}/${name}/releases/${release}/download/`
|
|
|
|
```
|
|
|
|
|
2021-02-02 23:47:46 +01:00
|
|
|
Examples:
|
|
|
|
|
|
|
|
```bash
|
2021-03-05 13:55:21 +01:00
|
|
|
# Edit package
|
2021-11-25 11:49:31 +01:00
|
|
|
curl -X PUT https://content.minetest.net/api/packages/username/name/ \
|
2021-02-02 23:47:46 +01:00
|
|
|
-H "Authorization: Bearer YOURTOKEN" -H "Content-Type: application/json" \
|
2021-02-03 01:11:48 +01:00
|
|
|
-d '{ "title": "Foo bar", "tags": ["pvp", "survival"], "license": "MIT" }'
|
2023-04-19 19:27:28 +02:00
|
|
|
|
2021-02-02 23:47:46 +01:00
|
|
|
# Remove website URL
|
2021-11-25 11:49:31 +01:00
|
|
|
curl -X PUT https://content.minetest.net/api/packages/username/name/ \
|
2021-02-02 23:47:46 +01:00
|
|
|
-H "Authorization: Bearer YOURTOKEN" -H "Content-Type: application/json" \
|
|
|
|
-d '{ "website": null }'
|
|
|
|
```
|
|
|
|
|
2021-02-02 21:05:24 +01:00
|
|
|
### Package Queries
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
/api/packages/?type=mod&type=game&q=mobs+fun&hide=nonfree&hide=gore
|
|
|
|
|
|
|
|
Supported query parameters:
|
|
|
|
|
2021-02-02 23:41:48 +01:00
|
|
|
* `type`: Package types (`mod`, `game`, `txp`).
|
|
|
|
* `q`: Query string.
|
|
|
|
* `author`: Filter by author.
|
|
|
|
* `tag`: Filter by tags.
|
2023-12-30 18:09:10 +01:00
|
|
|
* `flag`: Filter to show packages with [Content Flags](/help/content_flags/).
|
2023-04-19 19:27:28 +02:00
|
|
|
* `game`: Filter by [Game Support](/help/game_support/), ex: `Wuzzy/mineclone2`. (experimental, doesn't show items that support every game currently).
|
2024-02-26 01:45:25 +01:00
|
|
|
* `lang`: Filter by translation support, eg: `en`/`de`/`ja`/`zh_TW`.
|
2021-02-02 23:41:48 +01:00
|
|
|
* `random`: When present, enable random ordering and ignore `sort`.
|
|
|
|
* `limit`: Return at most `limit` packages.
|
|
|
|
* `hide`: Hide content based on [Content Flags](/help/content_flags/).
|
|
|
|
* `sort`: Sort by (`name`, `title`, `score`, `reviews`, `downloads`, `created_at`, `approved_at`, `last_release`).
|
|
|
|
* `order`: Sort ascending (`asc`) or descending (`desc`).
|
|
|
|
* `protocol_version`: Only show packages supported by this Minetest protocol version.
|
|
|
|
* `engine_version`: Only show packages supported by this Minetest engine version, eg: `5.3.0`.
|
2022-12-20 14:48:42 +01:00
|
|
|
* `fmt`: How the response is formatted.
|
2021-02-02 23:41:48 +01:00
|
|
|
* `keys`: author/name only.
|
2023-04-19 19:27:28 +02:00
|
|
|
* `short`: stuff needed for the Minetest client.
|
2021-02-02 21:05:24 +01:00
|
|
|
|
|
|
|
|
2022-11-09 21:43:31 +01:00
|
|
|
### Releases
|
2020-01-24 21:21:40 +01:00
|
|
|
|
2023-04-19 19:27:28 +02:00
|
|
|
* GET `/api/releases/` (List)
|
2021-03-05 13:55:21 +01:00
|
|
|
* Limited to 30 most recent releases.
|
|
|
|
* Optional arguments:
|
|
|
|
* `author`: Filter by author
|
|
|
|
* `maintainer`: Filter by maintainer
|
2021-02-02 18:09:28 +01:00
|
|
|
* Returns array of release dictionaries with keys:
|
|
|
|
* `id`: release ID
|
|
|
|
* `title`: human-readable title
|
|
|
|
* `release_date`: Date released
|
|
|
|
* `url`: download URL
|
|
|
|
* `commit`: commit hash or null
|
|
|
|
* `downloads`: number of downloads
|
|
|
|
* `min_minetest_version`: dict or null, minimum supported minetest version (inclusive).
|
|
|
|
* `max_minetest_version`: dict or null, minimum supported minetest version (inclusive).
|
2023-12-15 17:33:34 +01:00
|
|
|
* `size`: size of zip file, in bytes.
|
2021-03-05 13:55:21 +01:00
|
|
|
* `package`
|
2021-04-10 17:30:19 +02:00
|
|
|
* `author`: author username
|
|
|
|
* `name`: technical name
|
2021-03-05 13:55:21 +01:00
|
|
|
* `type`: `mod`, `game`, or `txp`
|
2023-09-12 22:15:55 +02:00
|
|
|
* GET `/api/updates/` (Look-up table)
|
|
|
|
* Returns a look-up table from package key (`author/name`) to latest release id
|
|
|
|
* Query arguments
|
|
|
|
* `protocol_version`: Only show packages supported by this Minetest protocol version.
|
|
|
|
* `engine_version`: Only show packages supported by this Minetest engine version, eg: `5.3.0`.
|
2021-03-05 13:55:21 +01:00
|
|
|
* GET `/api/packages/<username>/<name>/releases/` (List)
|
|
|
|
* Returns array of release dictionaries, see above, but without package info.
|
2021-02-02 18:09:28 +01:00
|
|
|
* GET `/api/packages/<username>/<name>/releases/<id>/` (Read)
|
2021-02-02 18:09:19 +01:00
|
|
|
* POST `/api/packages/<username>/<name>/releases/new/` (Create)
|
2021-02-02 18:09:25 +01:00
|
|
|
* Requires authentication.
|
2021-02-02 18:09:28 +01:00
|
|
|
* Body can be JSON or multipart form data. Zip uploads must be multipart form data.
|
2021-02-02 18:09:25 +01:00
|
|
|
* `title`: human-readable name of the release.
|
|
|
|
* For Git release creation:
|
|
|
|
* `method`: must be `git`.
|
|
|
|
* `ref`: (Optional) git reference, eg: `master`.
|
2023-04-19 19:27:28 +02:00
|
|
|
* For zip upload release creation:
|
2021-02-27 19:31:56 +01:00
|
|
|
* `file`: multipart file to upload, like `<input type="file" name="file">`.
|
|
|
|
* `commit`: (Optional) Source Git commit hash, for informational purposes.
|
2021-02-02 18:09:25 +01:00
|
|
|
* You can set min and max Minetest Versions [using the content's .conf file](/help/package_config/).
|
2021-02-02 18:09:28 +01:00
|
|
|
* DELETE `/api/packages/<username>/<name>/releases/<id>/` (Delete)
|
|
|
|
* Requires authentication.
|
|
|
|
* Deletes release.
|
2023-04-19 19:27:28 +02:00
|
|
|
|
2021-02-02 18:09:19 +01:00
|
|
|
Examples:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# Create release from Git
|
|
|
|
curl -X POST https://content.minetest.net/api/packages/username/name/releases/new/ \
|
2021-02-02 18:09:25 +01:00
|
|
|
-H "Authorization: Bearer YOURTOKEN" -H "Content-Type: application/json" \
|
2021-02-02 23:47:46 +01:00
|
|
|
-d '{ "method": "git", "title": "My Release", "ref": "master" }'
|
2021-02-02 18:09:19 +01:00
|
|
|
|
|
|
|
# Create release from zip upload
|
2021-02-02 18:09:28 +01:00
|
|
|
curl -X POST https://content.minetest.net/api/packages/username/name/releases/new/ \
|
2021-02-02 18:09:25 +01:00
|
|
|
-H "Authorization: Bearer YOURTOKEN" \
|
|
|
|
-F title="My Release" -F file=@path/to/file.zip
|
2021-02-02 18:09:28 +01:00
|
|
|
|
2021-02-27 19:31:56 +01:00
|
|
|
# Create release from zip upload with commit hash
|
|
|
|
curl -X POST https://content.minetest.net/api/packages/username/name/releases/new/ \
|
|
|
|
-H "Authorization: Bearer YOURTOKEN" \
|
|
|
|
-F title="My Release" -F commit="8ef74deec170a8ce789f6055a59d43876d16a7ea" -F file=@path/to/file.zip
|
|
|
|
|
2021-02-02 18:09:28 +01:00
|
|
|
# Delete release
|
|
|
|
curl -X DELETE https://content.minetest.net/api/packages/username/name/releases/3/ \
|
2023-04-19 19:27:28 +02:00
|
|
|
-H "Authorization: Bearer YOURTOKEN"
|
2021-02-02 18:09:19 +01:00
|
|
|
```
|
2020-01-24 21:21:40 +01:00
|
|
|
|
2021-02-02 21:05:24 +01:00
|
|
|
|
2022-11-09 21:43:31 +01:00
|
|
|
### Screenshots
|
2021-02-02 18:09:23 +01:00
|
|
|
|
2021-02-02 18:09:25 +01:00
|
|
|
* GET `/api/packages/<username>/<name>/screenshots/` (List)
|
|
|
|
* Returns array of screenshot dictionaries with keys:
|
|
|
|
* `id`: screenshot ID
|
|
|
|
* `approved`: true if approved and visible.
|
|
|
|
* `title`: human-readable name for the screenshot, shown as a caption and alt text.
|
|
|
|
* `url`: absolute URL to screenshot.
|
2021-02-02 18:29:03 +01:00
|
|
|
* `created_at`: ISO time.
|
2021-02-02 18:09:25 +01:00
|
|
|
* `order`: Number used in ordering.
|
2022-02-02 02:20:11 +01:00
|
|
|
* `is_cover_image`: true for cover image.
|
2021-02-02 18:09:25 +01:00
|
|
|
* GET `/api/packages/<username>/<name>/screenshots/<id>/` (Read)
|
|
|
|
* Returns screenshot dictionary like above.
|
2021-02-02 18:09:23 +01:00
|
|
|
* POST `/api/packages/<username>/<name>/screenshots/new/` (Create)
|
2021-02-02 18:09:25 +01:00
|
|
|
* Requires authentication.
|
|
|
|
* Body is multipart form data.
|
|
|
|
* `title`: human-readable name for the screenshot, shown as a caption and alt text.
|
|
|
|
* `file`: multipart file to upload, like `<input type=file>`.
|
2022-02-02 02:29:14 +01:00
|
|
|
* `is_cover_image`: set cover image to this.
|
2021-02-02 18:09:25 +01:00
|
|
|
* DELETE `/api/packages/<username>/<name>/screenshots/<id>/` (Delete)
|
|
|
|
* Requires authentication.
|
|
|
|
* Deletes screenshot.
|
|
|
|
* POST `/api/packages/<username>/<name>/screenshots/order/`
|
|
|
|
* Requires authentication.
|
|
|
|
* Body is a JSON array containing the screenshot IDs in their order.
|
2022-02-02 02:21:33 +01:00
|
|
|
* POST `/api/packages/<username>/<name>/screenshots/cover-image/`
|
2022-02-02 02:08:01 +01:00
|
|
|
* Requires authentication.
|
|
|
|
* Body is a JSON dictionary with "cover_image" containing the screenshot ID.
|
2021-02-02 18:09:23 +01:00
|
|
|
|
2021-11-25 11:49:31 +01:00
|
|
|
Currently, to get a different size of thumbnail you can replace the number in `/thumbnails/1/` with any number from 1-3.
|
|
|
|
The resolutions returned may change in the future, and we may move to a more capable thumbnail generation.
|
|
|
|
|
2021-02-02 18:09:25 +01:00
|
|
|
Examples:
|
2021-02-02 18:09:23 +01:00
|
|
|
|
|
|
|
```bash
|
2021-02-27 19:31:56 +01:00
|
|
|
# Create screenshot
|
2021-02-02 18:09:28 +01:00
|
|
|
curl -X POST https://content.minetest.net/api/packages/username/name/screenshots/new/ \
|
2021-02-02 18:09:25 +01:00
|
|
|
-H "Authorization: Bearer YOURTOKEN" \
|
|
|
|
-F title="My Release" -F file=@path/to/screnshot.png
|
2023-04-19 19:27:28 +02:00
|
|
|
|
2022-02-02 02:29:14 +01:00
|
|
|
# Create screenshot and set it as the cover image
|
|
|
|
curl -X POST https://content.minetest.net/api/packages/username/name/screenshots/new/ \
|
|
|
|
-H "Authorization: Bearer YOURTOKEN" \
|
|
|
|
-F title="My Release" -F file=@path/to/screnshot.png -F is_cover_image="true"
|
2021-02-02 18:09:25 +01:00
|
|
|
|
|
|
|
# Delete screenshot
|
|
|
|
curl -X DELETE https://content.minetest.net/api/packages/username/name/screenshots/3/ \
|
2023-04-19 19:27:28 +02:00
|
|
|
-H "Authorization: Bearer YOURTOKEN"
|
|
|
|
|
2021-02-02 18:09:25 +01:00
|
|
|
# Reorder screenshots
|
|
|
|
curl -X POST https://content.minetest.net/api/packages/username/name/screenshots/order/ \
|
|
|
|
-H "Authorization: Bearer YOURTOKEN" -H "Content-Type: application/json" \
|
|
|
|
-d "[13, 2, 5, 7]"
|
2023-04-19 19:27:28 +02:00
|
|
|
|
2022-02-02 02:08:01 +01:00
|
|
|
# Set cover image
|
|
|
|
curl -X POST https://content.minetest.net/api/packages/username/name/screenshots/cover-image/ \
|
|
|
|
-H "Authorization: Bearer YOURTOKEN" -H "Content-Type: application/json" \
|
|
|
|
-d "{ 'cover_image': 123 }"
|
2021-02-02 18:09:23 +01:00
|
|
|
```
|
|
|
|
|
2021-02-02 21:05:24 +01:00
|
|
|
|
2022-11-09 21:43:31 +01:00
|
|
|
### Reviews
|
2021-11-24 17:33:37 +01:00
|
|
|
|
2021-11-25 12:13:58 +01:00
|
|
|
* GET `/api/packages/<username>/<name>/reviews/` (List)
|
2021-11-24 17:33:37 +01:00
|
|
|
* Returns array of review dictionaries with keys:
|
|
|
|
* `user`: dictionary with `display_name` and `username`.
|
2023-04-19 19:27:28 +02:00
|
|
|
* `title`: review title
|
2021-11-24 17:33:37 +01:00
|
|
|
* `comment`: the text
|
2023-04-15 03:37:58 +02:00
|
|
|
* `rating`: 1 for negative, 3 for neutral, 5 for positive
|
2021-11-24 17:33:37 +01:00
|
|
|
* `is_positive`: boolean
|
|
|
|
* `created_at`: iso timestamp
|
|
|
|
* `votes`: dictionary with `helpful` and `unhelpful`,
|
|
|
|
* GET `/api/reviews/` (List)
|
2021-11-26 15:33:17 +01:00
|
|
|
* Returns a paginated response. This is a dictionary with `page`, `url`, and `items`.
|
2022-01-12 18:08:18 +01:00
|
|
|
* [Paginated result](#paginated-results)
|
2021-11-26 15:56:01 +01:00
|
|
|
* `items`: array of review dictionaries, like above
|
|
|
|
* Each review also has a `package` dictionary with `type`, `author` and `name`
|
2023-07-09 17:48:46 +02:00
|
|
|
* Ordered by created at, newest to oldest.
|
2021-11-26 15:33:17 +01:00
|
|
|
* Query arguments:
|
|
|
|
* `page`: page number, integer from 1 to max
|
2023-07-09 17:48:46 +02:00
|
|
|
* `n`: number of results per page, max 200
|
2021-11-26 15:33:17 +01:00
|
|
|
* `author`: filter by review author username
|
2023-07-09 17:48:46 +02:00
|
|
|
* `for_user`: filter by package author
|
2023-04-15 03:37:58 +02:00
|
|
|
* `rating`: 1 for negative, 3 for neutral, 5 for positive
|
2021-11-26 15:56:01 +01:00
|
|
|
* `is_positive`: true or false. Default: null
|
2023-06-19 20:32:36 +02:00
|
|
|
* `q`: filter by title (case-insensitive, no fulltext search)
|
2021-11-24 17:33:37 +01:00
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
```json
|
|
|
|
[
|
|
|
|
{
|
2023-04-19 19:27:28 +02:00
|
|
|
"comment": "This is a really good mod!",
|
|
|
|
"created_at": "2021-11-24T16:18:33.764084",
|
|
|
|
"is_positive": true,
|
|
|
|
"title": "Really good",
|
2021-11-24 17:33:37 +01:00
|
|
|
"user": {
|
2023-04-19 19:27:28 +02:00
|
|
|
"display_name": "rubenwardy",
|
2021-11-24 17:33:37 +01:00
|
|
|
"username": "rubenwardy"
|
2023-04-19 19:27:28 +02:00
|
|
|
},
|
2021-11-24 17:33:37 +01:00
|
|
|
"votes": {
|
2023-04-19 19:27:28 +02:00
|
|
|
"helpful": 0,
|
2021-11-24 17:33:37 +01:00
|
|
|
"unhelpful": 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
|
|
|
|
2022-11-09 21:43:31 +01:00
|
|
|
## Users
|
|
|
|
|
|
|
|
* GET `/api/users/<username>/`
|
|
|
|
* `username`
|
|
|
|
* `display_name`: human-readable name to be displayed in GUIs.
|
|
|
|
* `rank`: ContentDB [rank](/help/ranks_permissions/).
|
|
|
|
* `profile_pic_url`: URL to profile picture, or null.
|
|
|
|
* `website_url`: URL to website, or null.
|
|
|
|
* `donate_url`: URL to donate page, or null.
|
|
|
|
* `connections`: object
|
|
|
|
* `github`: GitHub username, or null.
|
|
|
|
* `forums`: forums username, or null.
|
|
|
|
* `links`: object
|
|
|
|
* `api_packages`: URL to API to list this user's packages.
|
|
|
|
* `profile`: URL to the HTML profile page.
|
|
|
|
* GET `/api/users/<username>/stats/`
|
|
|
|
* Returns daily stats for the user's packages, or null if there is no data.
|
|
|
|
* Daily date is done based on the UTC timezone.
|
|
|
|
* EXPERIMENTAL. This API may change without warning.
|
2023-06-14 23:47:08 +02:00
|
|
|
* Query args:
|
|
|
|
* `start`: start date, inclusive. Optional. Default: 2022-10-01. UTC.
|
|
|
|
* `end`: end date, inclusive. Optional. Default: today. UTC.
|
2022-11-09 21:43:31 +01:00
|
|
|
* A table with the following keys:
|
|
|
|
* `from`: start date, inclusive. Ex: 2022-10-22.
|
|
|
|
* `end`: end date, inclusive. Ex: 2022-11-05.
|
|
|
|
* `package_downloads`: map of package title to list of integers per day.
|
|
|
|
* `platform_minetest`: list of integers per day.
|
|
|
|
* `platform_other`: list of integers per day.
|
|
|
|
* `reason_new`: list of integers per day.
|
|
|
|
* `reason_dependency`: list of integers per day.
|
|
|
|
* `reason_update`: list of integers per day.
|
|
|
|
|
|
|
|
|
2021-02-02 21:05:24 +01:00
|
|
|
## Topics
|
2019-11-22 15:33:22 +01:00
|
|
|
|
2021-11-25 16:48:23 +01:00
|
|
|
* GET `/api/topics/` ([View](/api/topics/))
|
|
|
|
* See [Topic Queries](#topic-queries)
|
2019-11-22 15:33:22 +01:00
|
|
|
|
2021-02-02 21:05:24 +01:00
|
|
|
### Topic Queries
|
2020-07-10 23:32:52 +02:00
|
|
|
|
|
|
|
Example:
|
|
|
|
|
2021-11-25 16:48:23 +01:00
|
|
|
/api/topics/?q=mobs&type=mod&type=game
|
2020-07-10 23:32:52 +02:00
|
|
|
|
|
|
|
Supported query parameters:
|
|
|
|
|
2021-02-02 23:41:48 +01:00
|
|
|
* `q`: Query string.
|
2021-11-25 16:48:23 +01:00
|
|
|
* `type`: Package types (`mod`, `game`, `txp`).
|
|
|
|
* `sort`: Sort by (`name`, `views`, `created_at`).
|
2021-02-02 23:41:48 +01:00
|
|
|
* `show_added`: Show topics that have an existing package.
|
|
|
|
* `limit`: Return at most `limit` topics.
|
2021-02-02 21:05:24 +01:00
|
|
|
|
2023-08-20 22:47:20 +02:00
|
|
|
|
|
|
|
## Collections
|
|
|
|
|
|
|
|
* GET `/api/collections/`
|
|
|
|
* Query args:
|
|
|
|
* `author`: collection author username.
|
|
|
|
* `package`: collections that contain the package.
|
|
|
|
* Returns JSON array of collection entries:
|
|
|
|
* `author`: author username.
|
|
|
|
* `name`: collection name.
|
|
|
|
* `title`
|
|
|
|
* `short_description`
|
|
|
|
* `created_at`: creation time in iso format.
|
|
|
|
* `private`: whether collection is private, boolean.
|
|
|
|
* `package_count`: number of packages, integer.
|
|
|
|
* GET `/api/collections/<username>/<name>/`
|
|
|
|
* Returns JSON object for collection:
|
|
|
|
* `author`: author username.
|
|
|
|
* `name`: collection name.
|
|
|
|
* `title`
|
|
|
|
* `short_description`
|
|
|
|
* `long_description`
|
|
|
|
* `created_at`: creation time in iso format.
|
|
|
|
* `private`: whether collection is private, boolean.
|
|
|
|
* `items`: array of item objects:
|
|
|
|
* `package`: short info about the package.
|
|
|
|
* `description`: custom short description.
|
|
|
|
* `created_at`: when the package was added to the collection.
|
|
|
|
* `order`: integer.
|
|
|
|
|
2021-02-05 16:29:44 +01:00
|
|
|
## Types
|
2021-02-02 21:05:24 +01:00
|
|
|
|
2021-02-05 16:29:44 +01:00
|
|
|
### Tags
|
2021-02-02 21:05:24 +01:00
|
|
|
|
2024-02-26 02:50:15 +01:00
|
|
|
* GET `/api/tags/` ([View](/api/tags/))
|
|
|
|
* List of objects with:
|
|
|
|
* `name`: technical name.
|
|
|
|
* `title`: human-readable title.
|
|
|
|
* `description`: tag description or null.
|
|
|
|
* `views`: number of views of this tag.
|
2023-04-19 19:27:28 +02:00
|
|
|
|
2021-02-05 16:29:44 +01:00
|
|
|
### Content Warnings
|
|
|
|
|
2024-02-26 02:50:15 +01:00
|
|
|
* GET `/api/content_warnings/` ([View](/api/content_warnings/))
|
|
|
|
* List of objects with
|
|
|
|
* `name`: technical name
|
|
|
|
* `title`: human-readable title
|
|
|
|
* `description`: tag description or null
|
2021-02-05 16:29:44 +01:00
|
|
|
|
|
|
|
### Licenses
|
|
|
|
|
2024-02-26 02:50:15 +01:00
|
|
|
* GET `/api/licenses/` ([View](/api/licenses/))
|
|
|
|
* List of objects with:
|
|
|
|
* `name`
|
|
|
|
* `is_foss`: whether the license is foss
|
2021-02-05 16:29:44 +01:00
|
|
|
|
|
|
|
### Minetest Versions
|
|
|
|
|
|
|
|
* GET `/api/minetest_versions/` ([View](/api/minetest_versions/))
|
2024-02-26 02:50:15 +01:00
|
|
|
* List of objects with:
|
|
|
|
* `name`: Version name.
|
|
|
|
* `is_dev`: boolean, is dev version.
|
|
|
|
* `protocol_version`: protocol version number.
|
|
|
|
|
|
|
|
### Languages
|
|
|
|
|
|
|
|
* GET `/api/languages/` ([View](/api/languages/))
|
|
|
|
* List of objects with:
|
|
|
|
* `id`: language code.
|
|
|
|
* `title`: native language name.
|
|
|
|
* `has_contentdb_translation`: whether ContentDB has been translated into this language.
|
2021-02-05 16:29:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
## Misc
|
|
|
|
|
|
|
|
* GET `/api/scores/` ([View](/api/scores/))
|
|
|
|
* See [Top Packages Algorithm](/help/top_packages/).
|
|
|
|
* Supports [Package Queries](#package-queries).
|
|
|
|
* Returns list of:
|
|
|
|
* `author`: package author name.
|
|
|
|
* `name`: package technical name.
|
|
|
|
* `downloads`: number of downloads.
|
|
|
|
* `score`: total package score.
|
|
|
|
* `score_reviews`: score from reviews.
|
|
|
|
* `score_downloads`: score from downloads.
|
2024-06-01 01:06:25 +02:00
|
|
|
* `reviews`: a dictionary of
|
|
|
|
* `positive`: int, number of positive reviews.
|
|
|
|
* `neutral`: int, number of neutral reviews.
|
|
|
|
* `negative`: int, number of negative reviews.
|
2021-02-05 16:29:44 +01:00
|
|
|
* GET `/api/homepage/` ([View](/api/homepage/)) - get contents of homepage.
|
2021-02-02 23:41:48 +01:00
|
|
|
* `count`: number of packages
|
|
|
|
* `downloads`: get number of downloads
|
|
|
|
* `new`: new packages
|
|
|
|
* `updated`: recently updated packages
|
|
|
|
* `pop_mod`: popular mods
|
|
|
|
* `pop_txp`: popular textures
|
|
|
|
* `pop_game`: popular games
|
|
|
|
* `high_reviewed`: highest reviewed
|
2022-01-30 04:35:02 +01:00
|
|
|
* GET `/api/welcome/v1/` ([View](/api/welcome/v1/)) - in-menu welcome dialog. Experimental (may change without warning)
|
|
|
|
* `featured`: featured games
|
2023-01-03 13:43:18 +01:00
|
|
|
* GET `/api/cdb_schema/` ([View](/api/cdb_schema/))
|
2023-01-02 20:26:10 +01:00
|
|
|
* Get JSON Schema of `.cdb.json`, including licenses, tags and content warnings.
|
2023-01-03 13:43:18 +01:00
|
|
|
* See [JSON Schema Reference](https://json-schema.org/).
|
2023-08-13 14:50:02 +02:00
|
|
|
* POST `/api/hypertext/`
|
|
|
|
* Converts HTML or Markdown to [Minetest Markup Language](https://github.com/minetest/minetest/blob/master/doc/lua_api.md#markup-language)
|
|
|
|
to be used in a `hypertext` formspec element.
|
|
|
|
* Post data: HTML or Markdown as plain text.
|
|
|
|
* Content-Type: `text/html` or `text/markdown`.
|
|
|
|
* Query arguments:
|
|
|
|
* `formspec_version`: Required, maximum supported formspec version. Ie: 6
|
2024-04-05 19:17:07 +02:00
|
|
|
* `include_images`: Optional, defaults to true. If true, images use `<img>`. If false, they're linked.
|
2023-08-13 14:50:02 +02:00
|
|
|
* Returns JSON dictionary with following key:
|
|
|
|
* `head`: markup for suggested styling and custom tags, prepend to the body before displaying.
|
|
|
|
* `body`: markup for long description.
|
|
|
|
* `links`: dictionary of anchor name to link URL.
|
|
|
|
* `images`: dictionary of img name to image URL
|
2023-08-14 22:48:50 +02:00
|
|
|
* `image_tooltips`: dictionary of img name to tooltip text.
|