-
Notifications
You must be signed in to change notification settings - Fork 2
API Documentation
This explains how you can use this api.
~ is the base url of the api!
This route is used to create a new upload stream for uploading to.
Parameters:
Name | Description | Type |
---|---|---|
<ext> | The file extension | string (0 < len < 7) |
Result:
If the request succeeded you will receive a 64 character long string which is the id needed to access your upload stream.
Example:
POST http://localhost:6942/c/png
→ 85bvoJGgos5pD5p4yH3hGV-0GnpxsM6Kr7fRJwf-GGcC-xgfww6XHqFNVUwYH_i1
This route is used to upload a chunk of data to the upload stream.
Parameters:
Name | Description | Type |
---|---|---|
<id> | The upload stream id | string (len == 64, result of create) |
<hash> | The sha1 hash of the body | hex digest (lowercase len == 40) |
Body:
The body size must be under 2mb!
Result:
If the request succeeded you will receive an 'OK'.
Example:
POST http://localhost:6942/u/85bvoJGgos5pD5p4yH3hGV-0GnpxsM6Kr7fRJwf-GGcC-xgfww6XHqFNVUwYH_i1/539a0aaa37ae283644be2c1b47b8a3e48d8525e0 'Test somes'
→ OK
This route is used to close an upload stream. This will delete the tmp file that was generated.
Parameters:
Name | Description | Type |
---|---|---|
<id> | The upload stream id | string (len == 64, result of create) |
Result:
If the request succeeded you will receive an 'OK'.
Example:
POST http://localhost:6942/r/85bvoJGgos5pD5p4yH3hGV-0GnpxsM6Kr7fRJwf-GGcC-xgfww6XHqFNVUwYH_i1
→ OK
This route is used to finalize an upload stream.
Parameters:
Name | Description | Type |
---|---|---|
<id> | The upload stream id | (len == 64, result of create) |
<hash> | The sha1 hash of the entire file | hex digest (lowercase len == 40) |
Result:
If the request succeeded you will receive a string with the length 6 which is the final id used to download the file. You can access the file using download
Example:
POST http://localhost:6942/f/85bvoJGgos5pD5p4yH3hGV-0GnpxsM6Kr7fRJwf-GGcC-xgfww6XHqFNVUwYH_i1/539a0aaa37ae283644be2c1b47b8a3e48d8525e0
→ hG5D_q
This route is used to download an uploaded file. The id is the result of finish!
Parameters:
Name | Description | Type |
---|---|---|
<id> | The file id | string (len == 6) |
Result:
If the request succeeds and the id is valid you will receive the uploaded file.
Example:
GET http://localhost:6942/d/hG5D_q
→ Test somes
This route is used to embed an uploaded file on discord or other platforms that support embeding. The id is the result of finish!
Parameters:
Name | Description | Type |
---|---|---|
<id> | The file id | string (len == 6) |
Result:
If the request succeeds and the id is valid you will receive HTML which contains the correct tags to embed the file.
Made with ❤️ by KekOnTheWorld