API
Client
-To simplify uploading and deleting files, you can use linx-client, which uses this API.
+To simplify uploading and deleting files, you can use linx-client, which uses this API.
{% if auth != "none" %}Keys
-This instance uses API Keys, therefore you will need to provide a key for uploading and deleting files.
To do so, add the Linx-Api-Key
header with your key.
This instance uses API Keys, therefore you will need to provide a key for uploading and deleting
+ files.
To do so, add the Linx-Api-Key
header with your key.
Uploading a file
-To upload a file, make a PUT request to {{ siteurl }}upload/
and you will get the url of your upload back.
To upload a file, make a PUT request to {{ siteurl }}upload/
and you will get the url of
+ your upload back.
Optional headers with the request
-{% if not forcerandom %} -Randomize the filename
- Linx-Randomize: yes
Randomize the filename
+ Linx-Randomize: yes
Specify a custom deletion key
- Linx-Delete-Key: mysecret
Specify a custom deletion key
+ Linx-Delete-Key: mysecret
Protect file with password
- Linx-Access-Key: mysecret
Protect file with password
+ Linx-Access-Key: mysecret
Specify an expiration time (in seconds)
- Linx-Expiry: 60
Specify an expiration time (in seconds)
+ Linx-Expiry: 60
Get a json response
- Accept: application/json
Get a json response
+ Accept: application/json
The json response will then contain:
-“url”: the publicly available upload url
+
- “direct_url”: the url to access the file directly
- “filename”: the (optionally generated) filename
- “delete_key”: the (optionally generated) deletion key,
- “access_key”: the (optionally supplied) access key,
- “expiry”: the unix timestamp at which the file will expire (0 if never)
- “size”: the size in bytes of the file
- “mimetype”: the guessed mimetype of the file
- “sha256sum”: the sha256sum of the file,“url”: the publicly available upload url
+ “direct_url”: the url to access the file directly
+ “filename”: the (optionally generated) filename
+ “delete_key”: the (optionally generated) deletion key,
+ “access_key”: the (optionally supplied) access key,
+ “expiry”: the unix timestamp at which the file will expire (0 if never)
+ “size”: the size in bytes of the file
+ “mimetype”: the guessed mimetype of the file
+ “sha256sum”: the sha256sum of the file,
Examples
@@ -92,7 +97,8 @@Overwriting a file
-To overwrite a file you uploaded, simply provide the Linx-Delete-Key
header with the original file's deletion key.
To overwrite a file you uploaded, simply provide the Linx-Delete-Key
header with the
+ original file's deletion key.
Example
@@ -108,7 +114,8 @@Deleting a file
-To delete a file you uploaded, make a DELETE request to {{ siteurl }}yourfile.ext
with the delete key set as the Linx-Delete-Key
header.
To delete a file you uploaded, make a DELETE request to {{ siteurl }}yourfile.ext
with the
+ delete key set as the Linx-Delete-Key
header.
Example
@@ -124,16 +131,17 @@ DELETEDInformation about a file
-To retrieve information about a file, make a GET request the public url with Accept: application/json
headers and you will receive a json response containing:
To retrieve information about a file, make a GET request the public url with
+ Accept: application/json
headers and you will receive a json response containing:
-“url”: the publicly available upload url
+
- “direct_url”: the url to access the file directly
- “filename”: the (optionally generated) filename
- “expiry”: the unix timestamp at which the file will expire (0 if never)
- “size”: the size in bytes of the file
- “mimetype”: the guessed mimetype of the file
- “sha256sum”: the sha256sum of the file,“url”: the publicly available upload url
+ “direct_url”: the url to access the file directly
+ “filename”: the (optionally generated) filename
+ “expiry”: the unix timestamp at which the file will expire (0 if never)
+ “size”: the size in bytes of the file
+ “mimetype”: the guessed mimetype of the file
+ “sha256sum”: the sha256sum of the file,
Example
@@ -141,6 +149,6 @@ DELETED$ curl -H "Accept: application/json" {{ siteurl }}myphoto.jpg
{"expiry":"0","filename":"myphoto.jpg","mimetype":"image/jpeg","sha256sum":"...","size":"..."}