Files
API files
Tip
Ensure you have completed the configuration steps Here
How to manipulate the Express.js File manager
Get all Files
Request
GET
http://localhost:5501/api/v1/file
Response
{
"status": "String",
"filesDetails": "Array"
}
Response Validation
- status - response status
- filesDetails - Array containing all files and their details
Example
Response
{
"status": "success",
"filesDetails": [
{
"size": 153926,
"name": "selfie.png",
"path": "public/files/upload/selfie.png",
"ext": ".png",
"isDirectory": false,
"isImage": true,
"isMedia": false,
"date": "2022-06-24T07:02:15.697Z"
}
]
}
Add a new File
Request Form-Data
file: Any
Body Validation
- file - any file with any format
Request
POST
http://localhost:5501/api/v1/file
Response
{
"status": "String",
"message": "String"
}
Response Validation
- status - request status
- message - response message
Example
Form-Data
file: hello.pdf
Response
{
"status": "success",
"mesage": "file uploaded"
}
Update File
Request body
{
"name":"String",
"path":"String",
"rename":"Array"
}
Body Validation
- name - file name
- path - file path
- rename - new file name
Request
PATCH
http://localhost:5501/api/v1/file
Response
{
"status": "String",
"message": "String"
}
Response Validation
- status - request status
- message - response message
Example
Body
{
"name":"ahaa.pdf",
"path":"public/files/upload/ahaa.pdf",
"rename":"myphoto"
}
Response
{
"status": "success",
"mesage": "File Renamed"
}
Delete File
Request body
{
"name":"String",
"path":"String"
}
Body Validation
- name - file name
- path - file path
Request
DELETE
http://localhost:5501/api/v1/file
Response
{
"status": "String",
"message": "String"
}
Response Validation
- status - request status
- message - response message
Example
Body
{
"name":"myphoto.pdf",
"path":"public/files/upload/myphoto.pdf"
}
Response
{
"status": "success",
"mesage": "File removed"
}