API
Get informations about the server
Request
- URL:
/infos - Method:
GET
No query parameters.
Example with curl:
curl https://lut.im/infos
Response
{
"always_encrypt": true,
"broadcast_message": "[fr] Le délai par défaut est maintenant d'un an! [en] The default delay is now one year!",
"contact": "Luc Didry, admin[AT]lut.im",
"default_delay": 365,
"image_magick": true,
"max_delay": 0,
"max_file_size": 10485760
}
Please refer to the configuration's wiki page to understand the response. The exception is image_magick, which tells you if ImageMagick is installed on the server so it can create thumbnails and auto-rotate the images.
Add images
Request
- URL:
/ - Method:
POST
Query parameters:
| name | type | description | optional/mandatory | default |
|---|---|---|---|---|
| format | string | json if you want to get a json response, otherwise it will send a web page |
optional | html |
| file | file | the image file | mandatory | no default |
| delete-day | int | number of days you want the image to stay | optional | 0 (indefinitely) or the configured maximum delay of the server |
| first-view | int | if not 0, the image will be deleted at first view | optional | 0 |
| keep-exif | int | if not 0, the image will keep its EXIF tags | optional | 0 |
| crypt | int | if not 0, the image will be encrypted on the server | optional | depends on the instance configuration |
Example with curl:
curl -F "format=json" -F "file=@/tmp/snap0001.jpg" https://lut.im
You can allow people to use your instance of Lutim from other domains.
Add the allowed domains as an array in the allowed_domains conf option. Put ['*'] if you want to allow all domains.
Response
{
"success": true,
"msg": {
"real_short": "abc",
"short": "abc/def",
"token": "ghijkl",
"thumb": XXX,
"filename": "myimage.png",
"created_at": 1496652085,
"del_at_view": false,
"ext": "png",
"limit": 0
}
}
| parameter | type | role |
|---|---|---|
| success | true/false | upload-status |
| msg.real_short | string | image identifier |
| msg.short | string | real_short + encryption key |
| msg.token | string | |
| msg.thumb | string | base64 encoded thumbnail of the image, if PerlMagick is installed on the server |
| msg.filename | string | filename of the uploaded image |
| msg.create_at | int | unix timestamp of image upload |
| msg.del_at_view | true/false | will it be deleted at first view? |
| msg.ext | string | filename extension |
| msg.limit | int | deletion delay (0 means no deletion) |
Delete images
Request
- URL:
/d/real_short/token - Method:
GET
Please, refer to "Add images" response for real_short and token in the URL.
Query parameters:
| name | type | description | optional/mandatory | default |
|---|---|---|---|---|
| format | string | json if you want to get a json response, otherwise it will send a web page |
optional | html |
Response
{
"success": true,
"msg": "The image *filename* has been successfully deleted"
}
| parameter | type | role |
|---|---|---|
| success | true/false | delete-status |
| msg | string | success or failure message |
Modify images
Request
- URL:
/m/real_short/token - Method:
POST
Please, refer to "Add images" response for real_short and token in the URL.
Query parameters:
| name | type | description | optional/mandatory | default |
|---|---|---|---|---|
| delete-day | int | number of days you want the image to stay | mandatory | no default |
| first-view | int | if not 0, the image will be deleted at first view | optional | 0 |
| url | string | the view link of the image. Useless, it will be displayed if format is json |
optional | no default |
| format | string | json if you want to get a json response, otherwise it will send a web page |
optional | html |
Response
{
"success": true,
"msg": "Le délai de l'image a été modifié avec succès."
}
| parameter | type | role |
|---|---|---|
| success | true/false | modify-status |
| msg | string | success or failure message |
Get images
Request
- URL:
/short - Method:
GET
Example with curl:
curl https://lut.im/image.jpg
Response
The image.
Get informations about an image
Request
- URL:
/about/short - Method:
GET
NB: short can be the real_short, with or without the file extension.
Example with curl:
curl https://lut.im/about/image.jpg
Response
{
"success": true,
"data": {
"height":632,
"width":1680
}
}
| parameter | type | role |
|---|---|---|
| success | true/false | request-status |
| data.height | int | the height of the image |
| data.width | int | the width of the image |
Get counter and status of image
Request
- URL:
/c - Method:
POST
Query parameters:
| name | type | description | optional/mandatory | default |
|---|---|---|---|---|
| short | string | see what real_short is in the "Add images" URL response |
mandatory | no default |
| token | string | see what token is in the "Add images" URL response |
mandatory | no default |
Response
{
"success": true,
"counter": 42,
"enabled": false
}
Or, if it fails:
{
"success": false,
"msg": "Unable to get counter"
}
| parameter | type | role |
|---|---|---|
| success | true/false | request-status |
| counter | int | number of times the image has been accessed (warning, the browser cache prevents to increment the counter more than one time per browser) |
| enabled | true/false | if true, the image is still available, else it has been deleted (manually or it has expired) |
| msg | string | failure message |
Login
(when authentication is required)
Request
- URL:
/login - Method:
POST
Query parameters:
| name | type | description | optional/mandatory | default |
|---|---|---|---|---|
| login | string | your login | mandatory | no default |
| password | string | your password | mandatory | no default |
| format | string | json if you want to get a json response, otherwise it will send a web page |
optional | html |
Example with curl:
curl --data "login=luc" --data "password=toto" --data "format=json" https://lut.im/login
Response
{
"success": true,
"msg": "You have been successfully logged in."
}
Or, if it fails:
{
"success": false,
"msg": "Please, check your credentials: unable to authenticate."
}
| parameter | type | role |
|---|---|---|
| success | true/false | login-status |
| msg | string | success or failure message |
Logout
(when authentication is required)
Request
- URL:
/logout - Method:
GET
Query parameters:
| name | type | description | optional/mandatory | default |
|---|---|---|---|---|
| format | string | json if you want to get a json response, otherwise it will send a web page |
optional | html |
Example with curl:
curl "https://lut.im/logout?format=json"
Response
{
"success": true,
"msg": "You have been successfully logged out."
}
| parameter | type | role |
|---|---|---|
| success | true/false | logout-status |
| msg | string | success or failure message |
You can now go back to wiki's homepage.