API
Uploading a file
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
Randomize the filename
Linx-Randomize: yes
Specify a custom deletion key
Linx-Delete-Key: mysecret
Specify an expiration time (in seconds)
Linx-Expiry: 60
Get a json response
Accept: application/json
The json response will then contain:
“url”: the publicly available upload url
“filename”: the (optionally generated) filename
“delete_key”: the (optionally generated) deletion 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
Uploading myphoto.jpg
$ curl -T myphoto.jpg {{ siteurl }}upload/
{{ siteurl }}myphoto.jpg
Uploading myphoto.jpg with an expiry of 20 minutes
$ curl -H "Linx-Expiry: 1200" -T myphoto.jpg {{ siteurl }}upload/
{{ siteurl }}myphoto.jpg
Uploading myphoto.jpg with a random filename and getting a json response:
$ curl -H "Accept: application/json" -H "Linx-Randomize: yes" -T myphoto.jpg {{ siteurl }}/upload/
{"delete_key":"...","expiry":"0","filename":"f34h4iu.jpg","mimetype":"image/jpeg",
"sha256sum":"...","size":"...","url":"{{ steurl }}/f34h4iu.jpg"}
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.
Example
To delete myphoto.jpg
$ curl -H "Linx-Delete-Key: mysecret" -X DELETE {{ siteurl }}myphoto.jpg
DELETED
Information 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:
“url”: the publicly available upload url
“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
$ curl -H "Accept: application/json" {{ siteurl }}/myphoto.jpg
{"expiry":"0","filename":"myphoto.jpg","mimetype":"image/jpeg","sha256sum":"...","size":"..."}