update API docs

This commit is contained in:
Wim Brand
2020-02-07 09:57:16 +01:00
parent ecab08b5ae
commit 1fa14d2ab9

View File

@@ -65,7 +65,7 @@
{ {
"success": false, "success": false,
"value": "file_too_large", "value": "file_too_large",
"message": "The file you tried to upload is too large. Max 5000 MB allowed." "message": "The file you tried to upload is too large"
}</pre> }</pre>
<pre>HTTP 500: Internal Server Error <pre>HTTP 500: Internal Server Error
{ {
@@ -96,6 +96,21 @@
attachment header instead of inline rendering, which causes the attachment header instead of inline rendering, which causes the
browser to show a 'Save File' dialog. browser to show a 'Save File' dialog.
</p> </p>
<p>
Warning: If a file is using too much bandwidth it can be rate
limited. The rate limit will be enabled if a file has ten times more
downloads than views. The owner of a file can always download it.
When a file is rate limited the user will need to fill out a captcha
in order to continue downloading the file. The captcha will only
appear on the file viewer page (pixeldrain.com/u/{id}). Rate
limiting has been added to prevent the spread of viruses and to stop
direct linking.
</p>
<p>
Pixeldrain also includes a virus scanner. If a virus has been
detected in a file the user will also have to fill in a captcha to
download it.
</p>
<h3>Parameters</h3> <h3>Parameters</h3>
<table> <table>
<tr> <tr>
@@ -118,7 +133,31 @@
</tr> </tr>
</table> </table>
<h3>Returns</h3> <h3>Returns</h3>
A file output stream. <pre>HTTP 200: OK
The requested file.
</pre>
<pre>HTTP 404: Not Found
{
"success": false,
"value": "not_found",
"message": "The entity you requested could not be found"
}
</pre>
<pre>HTTP 403: Forbidden
{
"success": false,
"value": "file_rate_limited_captcha_required",
"message": "This file is using too much bandwidth. For anonymous downloads a captcha is required now. The captcha entry is available on the download page"
}
</pre>
<pre>HTTP 403: Forbidden
{
"success": false,
"value": "virus_detected_captcha_required",
"message": "This file has been marked as malware by our scanning systems. To avoid infecting other systems through automated downloads we require you to enter a captcha. The captcha entry is available on the download page"
}
</pre>
</div> </div>
</details> </details>
{{end}} {{end}}
@@ -152,17 +191,15 @@
<pre>HTTP 200: OK <pre>HTTP 200: OK
{ {
"success": true, "success": true,
"id": "123abc", "id": "1234abcd",
"name": "screenshot.png", "name": "screenshot.png",
"date_upload": 1485894987, // Timestamp "date_upload": 2020-02-04T18:34:05.706801Z,
"date_last_view": 1485894987, // Timestamp "date_last_view": 2020-02-04T18:34:05.706801Z,
"size": 5694837, // Bytes "size": 5694837, // Bytes
"views" 1234, // Amount of unique file views "views" 1234, // Amount of unique file views
"bandwidth_used": 1234567890, // Bytes "bandwidth_used": 1234567890, // Bytes
"mime_type" "image/png", "mime_type" "image/png",
"description": "File description", "thumbnail_href": "/file/1234abcd/thumbnail" // Link to a thumbnail of this file
"mime_image": "http://pixeldra.in/res/img/mime/image-png.png", // Image associated with the mime type
"thumbnail": "http://pixeldra.in/api/thumbnail/123abc" // Link to a thumbnail of this file
}</pre> }</pre>
<pre>HTTP 404: Not Found <pre>HTTP 404: Not Found
{ {