Easily upload files (and paste things, and shorten URLs) to your HTTP server and share them with your friends using a nice link.
Everything. Updates coming soon. Maybe.
- If you want to make a client and you (rightfully) like Python you may be interested in 115100/ll_functions, a (kind-of-)library that implements all of the API calls.
- If you like Go or (rightfully) hate PHP you should take a look at moshee/airlift. Also his CLI client has a cooler progress bar.
Every function is accessible from the HTTP/JSON API.
- All requests must be POSTed to the API route:
/apiif you're using the PATH routing mode or?apiif you're using GET. - All requests must be of
Content-Type: multipart/form-data - All requests must have a header part with
Content-Disposition: form-data; name="headers"; filename="headers"for the actual JSON request.
Get an authentication token to be used with other requests.
{ "action": "get_token",
"username": "<YOUR_USERNAME>",
"password": "<YOUR_PASSWORD>" }
HTTP Status Code: 200
{ "message": "OK.",
"token": "<TOKEN>" }
HTTP Status Code: 403
{ "message": "Access Denied." }
Get <LIMIT> links starting from <OFFSET>.
{ "action": "get_links",
"limit": "<LIMIT>",
"offset": "<OFFSET>",
"token": "<YOUR_AUTHENTICATION_TOKEN>" }
HTTP Status Code: 200
{ "message": "OK.",
"links": [ { "uid": "<ITEM_UID>",
"path": "<ITEM_PATH>",
"name": "<ITEM_NAME>",
"ext": "<ITEM_EXTENSION>",
"mime": "<ITEM_MIMETYPE>" },
... ] }
Get the <TOTAL> number of items.
{ "action": "count",
"token": "<YOUR_AUTHENTICATION_TOKEN>" }
HTTP Status Code: 200
{ "message": "OK.",
"count": <TOTAL> }
Get the thumbnail (base64 encoded) of an image item.
{ "action": "get_thumbnail",
"token": "<YOUR_AUTHENTICATION_TOKEN>" }
HTTP Status Code: 200
{ "message": "OK.",
"thumbnail": { "data": "<BASE64_ENCODED_THUMBNAIL>",
"width": "<THUMBNAIL_WIDTH>",
"height": "<THUMBNAIL_HEIGHT>",
"mime": "<THUMBNAIL_MIMETYPE>" } }
HTTP Status Code: 202
{ "message": "Could not get thumbnail." }
Upload an item. In this case you need another part with Content-Disposition: form-data; name="data"; filename="data" for the actual file data.
{ "action": "upload",
"filename": "<FILENAME>",
"token": "<YOUR_AUTHENTICATION_TOKEN>" }
HTTP Status Code: 201
{ "message": "OK.",
"uid": "<ITEM_UID>",
"name": "<ITEM_FILENAME>",
"mime": "<ITEM_MIMETYPE>",
"ext": "<ITEM_EXTENSION>",
"link": "<ITEM_LINK>" }
HTTP Status Code: 202
{ "message": "Upload Failed." }
Shorten an URL.
{ "action": "upload",
"url": "<URL>",
"token": "<YOUR_AUTHENTICATION_TOKEN>" }
HTTP Status Code: 201
{ "message": "OK.",
"uid": "<ITEM_UID>",
"link": "<ITEM_LINK>" }
HTTP Status Code: 202
{ "message": "Shortening Failed." }
Delete an item by its <UID>.
{ "action": "delete",
"uid": "<UID>",
"token": "<YOUR_AUTHENTICATION_TOKEN>" }
HTTP Status Code: 200
{ "message": "OK." }
Edit any of the settings you can find in default_settings.ini. Any number of them can be put inside the "settings" dictionary.
Be aware that this requires the password to be sent to the API. Just the authentication token isn't enough.
{ "action": "edit_settings",
"settings": <SETTINGS_DICTIONARY>,
"password": "<YOUR_PASSWORD>"
"token": "<YOUR_AUTHENTICATION_TOKEN>" }
HTTP Status Code: 200
{ "message": "OK." }
HTTP Status Code: 202
{ "message": "Could not update settings. Reason: <ERROR_MESSAGE>" }
HTTP Status Code: 403
{ "message": "Could not update settings: wrong password." }
Release the current authentication token.
{ "action": "release_token",
"token": "<YOUR_AUTHENTICATION_TOKEN>" }
HTTP Status Code: 200
{ "message": "OK." }
Release all authentication tokens.
{ "action": "release_all_tokens",
"token": "<YOUR_AUTHENTICATION_TOKEN>" }
HTTP Status Code: 200
{ "message": "OK." }
Prune unused links (i.e. delete database entries for the items whose associated files you have manually deleted from the server).
{ "action": "prune_unused",
"token": "<YOUR_AUTHENTICATION_TOKEN>" }
HTTP Status Code: 200
{ "message": "OK."
"pruned": <NUMBER_OF_PRUNED_ITEMS> }
If your request is badly formatted you"ll get the following response:
HTTP Status Code: 400
{ "message": "Badly Formatted Request." }
Alternatively files may be uploaded by sending a Content-Type: multipart/form-data request to the main API endpoint with a single part in this format:
Content-Disposition: form-data; name="file"; filename="<FILENAME>"
<PAYLOAD>
The request will need to provide an Authorization: Bearer <YOUR_AUTHENTICATION_TOKEN> header.
HTTP Status Code: 201
Payload: <ITEM_LINK>
HTTP Status Code: 202
Payload: Upload Failed.
HTTP Status Code: 403
Payload: Access Denied.