Self-hosted storage
If our integrated storage providers don't fit your needs we offer an ability to use your self-hosted storage using various API endpoints. This way we offer a possibility to use our integrated File Manager together with your self-hosted images.
Before implementing the endpoints, check how to work with API endpoints.
List Images
- URL:
/{API.FOLDERS}
- Method:
GET
- Params:
path
,userId
,uuid
- Content-Type:
application/json
Called when File Manager opens. This call used for retrieving files and folders.
Response:
json
[{
"name": "filename",
"date": "last-date-modified",
"size": 500,
"path": "/path/",
"type": "file" OR "folder",
"extension": ".jpg",
"url": "https://url-to-image.com/image.jpeg"
}]
Insert Folder
Method: POST
- URL:
/{API.FOLDERS}
- Method:
POST
- Content-Type:
application/json
Called when folder is added to the filemanager.
Body:
json
{
"name": "folder name where the images is added",
"path": "new image directory"
}
Response:
json
[
{
"url": "url_of_uploaded_image",
},
];
Delete images or folders
- URL:
/{API.FOLDERS}/delete
- Method:
POST
- Content-Type:
application/json
INFO
We append /delete
to the api.FOLDER
URL automatically.
Body:
json
[
{
"name": "name-of-the-file.jpg",
"type": "file",
"path": "/"
},
{
"name": "name-of-the-folder",
//
"type": "folder",
"path": "/",
"key": null
}
]
Response:
Status code 200
or 204
.
Image upload
- URL:
/{API.IMAGE_UPLOAD}
- Method:
POST
- Content-Type:
application/json
Called when the user wants to upload a new file.
INFO
This endpoint is used even when user drops image to the image block.
Body:
json
{
"image": "(binary)",
"path": "/",
"uuid": "username"
}
Response:
json
{
"success": true,
"url": "http://191n.mj.am/img/191n/1t/hs.png"
}
Image upload from image editor
- URL:
/{API.IMAGE_EDITOR_UPLOAD}
- Method:
POST
- Content-Type:
application/json
You should use this endpoint when retrieving edited image from integrated image editor.
Request:
json
{
"content": "base64 encoded image",
"filename": "Name of the file"
}
Response:
json
{
"url": "https://url-to-image.com/image.jpeg"
}