Skip to content
Snippets Groups Projects
Commit 088b9cc9 authored by Travis Ralston's avatar Travis Ralston
Browse files

Add docs for new datastore endpoints

parent aa71e7f4
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ All the API calls here require your user ID to be listed in the configuration as ...@@ -4,7 +4,7 @@ All the API calls here require your user ID to be listed in the configuration as
## Remote media purge ## Remote media purge
URL: `POST /_matrix/media/r0/admin/purge_remote?before_ts=1234567890&access_token=your_access_token` (`before_ts` is in milliseconds) URL: `POST /_matrix/media/unstable/admin/purge_remote?before_ts=1234567890&access_token=your_access_token` (`before_ts` is in milliseconds)
This will delete remote media from the file store that was downloaded before the timestamp specified. If the file is referenced by newer remote media or local files to any of the configured homeservers, it will not be deleted. Be aware that removing a homeserver from the config will cause it to be considered a remote server, and therefore the media may be deleted. This will delete remote media from the file store that was downloaded before the timestamp specified. If the file is referenced by newer remote media or local files to any of the configured homeservers, it will not be deleted. Be aware that removing a homeserver from the config will cause it to be considered a remote server, and therefore the media may be deleted.
...@@ -12,7 +12,7 @@ Any remote media that is deleted and requested by a user will be downloaded agai ...@@ -12,7 +12,7 @@ Any remote media that is deleted and requested by a user will be downloaded agai
## Quarantine media ## Quarantine media
URL: `POST /_matrix/media/r0/admin/quarantine/<server>/<media id>?access_token=your_access_token` URL: `POST /_matrix/media/unstable/admin/quarantine/<server>/<media id>?access_token=your_access_token`
The `<server>` and `<media id>` can be retrieved from an MXC URI (`mxc://<server>/<media id>`). The `<server>` and `<media id>` can be retrieved from an MXC URI (`mxc://<server>/<media id>`).
...@@ -23,3 +23,63 @@ Remote media that has been quarantined will not be purged either. This is so tha ...@@ -23,3 +23,63 @@ Remote media that has been quarantined will not be purged either. This is so tha
Quarantining media will also quarantine any media with the same file hash. Quarantining media will also quarantine any media with the same file hash.
This API is unique in that it can allow administrators of configured homeservers to quarantine media on their homeserver only. This will not allow local administrators to quarantine remote media or media on other homeservers though, just on theirs. This API is unique in that it can allow administrators of configured homeservers to quarantine media on their homeserver only. This will not allow local administrators to quarantine remote media or media on other homeservers though, just on theirs.
## Datastore management
Datastores are used by the media repository to put files. Typically these match what is configured in the config file, such as s3 and directories.
#### Listing available datastores
URL: `GET /_matrix/media/unstable/admin/datastores?access_token=your_access_token`
The result will be something like:
```json
{
"00be9363007feb66de554a79e16b7b49": {
"type": "file",
"uri": "/mnt/media"
},
"2e17bad1bf76c9618e3cde30166dc674": {
"type": "s3",
"uri": "s3:\/\/example.org\/bucket-name"
}
}
```
In the above response, `00be9363007feb66de554a79e16b7b49` and `2e17bad1bf76c9618e3cde30166dc674` are datastore IDs.
#### Estimating size of a datastore
URL: `GET /_matrix/media/unstable/admin/datastores/<datastore id>/size_estimate?access_token=your_access_token`
Sample response:
```json
{
"thumbnails_affected": 672,
"thumbnail_hashes_affected": 598,
"thumbnail_bytes": 49087657,
"media_affected": 372,
"media_hashes_affected": 346,
"media_bytes": 340907359,
"total_hashes_affected": 779,
"total_bytes": 366601489
}
```
#### Transferring media between datastores
URL: `POST /_matrix/media/unstable/admin/datastores/<source datastore id>/transfer_to/<destination datastore id>?access_token=your_access_token`
The response is the estimated amount of data being transferred:
```json
{
"thumbnails_affected": 672,
"thumbnail_hashes_affected": 598,
"thumbnail_bytes": 49087657,
"media_affected": 372,
"media_hashes_affected": 346,
"media_bytes": 340907359,
"total_hashes_affected": 779,
"total_bytes": 366601489
}
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment