API

Client

To simplify uploading and deleting files, you can use linx-client, which uses this API.

Uploading a file

To upload a file, make a PUT request to https://ln.vprw.ru/upload/ and you will get the url of your upload back.

Optional headers with the request

Specify a custom deletion key
Linx-Delete-Key: mysecret

Protect file with password
Linx-Access-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
“direct_url”: the url to access the file directly
“filename”: the random filename
“delete_key”: the (optionally generated) deletion key,
“access_key”: the (optionally supplied) access key,
“original_name”: the name of the original file,
“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 https://ln.vprw.ru/upload/
https://ln.vprw.ru/wtq7pan4o.jpg

Uploading myphoto.jpg with an expiry of 20 minutes

$ curl -H "Linx-Expiry: 1200" -T myphoto.jpg https://ln.vprw.ru/upload/
https://ln.vprw.ru/1d7oym9u2o.jpg

Uploading myphoto.jpg and getting a json response:

$ curl -H "Accept: application/json" -T myphoto.jpg https://ln.vprw.ru/upload/
{"delete_key":"...","expiry":"0","filename":"f34h4iuj7.jpg","mimetype":"image/jpeg",
"sha256sum":"...","size":"...","url":"https://ln.vprw.ru/f34h4iuj7.jpg","original_name":"myphoto.jpg"}

Deleting a file

To delete a file you uploaded, make a DELETE request to https://ln.vprw.ru/yourfile.ext with the delete key set as the Linx-Delete-Key header.

Example

To delete f34h4iuj7.jpg

$ curl -H "Linx-Delete-Key: mysecret" -X DELETE https://ln.vprw.ru/f34h4iuj7.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
“direct_url”: the url to access the file directly
“filename”: the random filename
"original_name": the name of the original file
“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" https://ln.vprw.ru/f34h4iuj7.jpg
{"expiry":"0","filename":"f34h4iuj7.jpg","mimetype":"image/jpeg","sha256sum":"...","size":"...",
"original_name":"myphoto.jpg"}