File Management API
These endpoints manage files and media in your EverShop store. All file management endpoints require admin authentication.
File Operations
Browse Files
Lists files in a directory. The path after /files/ specifies which directory to browse.
Request Schema (application/json)
No request body requiredGET/api/files/{path}
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Authorization: Bearer <admin JWT token>"
https://<your domain>/api/files/{path}
fetch('https://<your domain>/api/files/{path}', {
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer <admin JWT token>'
}
})
.then(response => response.json())
.then(data => {
if(data.error) {
// Handle the error
} else {
// Handle the data
}
})
.catch(error => {
// Handle the error
});
Sample Of Response
{
"data": {
"files": [
{
"name": "product-image.jpg",
"type": "file",
"size": 45230,
"path": "catalog/products/product-image.jpg"
},
{
"name": "thumbnails",
"type": "directory",
"path": "catalog/products/thumbnails"
}
]
}
}
Upload File
Uploads a file to the specified directory path. Send the file as multipart form data.
Request Schema (application/json)
No request body requiredPOST/api/files/{path}
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Authorization: Bearer <admin JWT token>"
--data-raw '<JSON DATA>'
https://<your domain>/api/files/{path}
fetch('https://<your domain>/api/files/{path}', {
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer <admin JWT token>'
},
body: <JSON DATA>
})
.then(response => response.json())
.then(data => {
if(data.error) {
// Handle the error
} else {
// Handle the data
}
})
.catch(error => {
// Handle the error
});
Sample Of Response
{
"data": {
"files": [
{
"name": "uploaded-file.pdf",
"path": "documents/uploaded-file.pdf",
"size": 102400
}
]
}
}
Delete File
Deletes a file at the specified path.
Request Schema (application/json)
No request body requiredDELETE/api/files/{path}
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Authorization: Bearer <admin JWT token>"
https://<your domain>/api/files/{path}
fetch('https://<your domain>/api/files/{path}', {
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer <admin JWT token>'
}
})
.then(response => response.json())
.then(data => {
if(data.error) {
// Handle the error
} else {
// Handle the data
}
})
.catch(error => {
// Handle the error
});
Sample Of Response
{
"data": {
"success": true
}
}
Image Operations
Upload Image
Uploads an image file with automatic processing (resizing, thumbnail generation). Send the image as multipart form data.
Request Schema (application/json)
No request body requiredPOST/api/images/{path}
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Authorization: Bearer <admin JWT token>"
--data-raw '<JSON DATA>'
https://<your domain>/api/images/{path}
fetch('https://<your domain>/api/images/{path}', {
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer <admin JWT token>'
},
body: <JSON DATA>
})
.then(response => response.json())
.then(data => {
if(data.error) {
// Handle the error
} else {
// Handle the data
}
})
.catch(error => {
// Handle the error
});
Sample Of Response
{
"data": {
"files": [
{
"name": "product-photo.jpg",
"path": "catalog/products/product-photo.jpg",
"thumb": "catalog/products/product-photo-thumb.jpg"
}
]
}
}
Folder Operations
Create Folder
Creates a new directory in the media storage.
Request Schema (application/json)
| Field Name | Field Type | Required |
|---|---|---|
| path | string | Yes |
POST/api/folders
- cURL
- JavaScript
curl
-H "Accept: application/json"
-H "Authorization: Bearer <admin JWT token>"
--data-raw '<JSON DATA>'
https://<your domain>/api/folders
fetch('https://<your domain>/api/folders', {
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer <admin JWT token>'
},
body: <JSON DATA>
})
.then(response => response.json())
.then(data => {
if(data.error) {
// Handle the error
} else {
// Handle the data
}
})
.catch(error => {
// Handle the error
});
Sample Of Response
{
"data": {
"path": "catalog/new-folder",
"success": true
}
}