Documentação em Português: link
Documentation in English below
🗂 API for file transfer.
API Description: It is a service that allows you to upload and download files. It was developed using Spring Boot, Java, and provides endpoints for file manipulation, including uploading and downloading single and multiple files.
- Endpoints
- File type File
- Upload a file
- Upload multiple files
- File type Part
- Upload a file
- Upload multiple files
- Download a file
- Download multiple files
- File type File
- Comments
- Contact
Endpoint: POST /api/file/upload
Description: Uploads a single file of type File.
Parameter:
file
: File to be sent of type File.
Successful Response:
{
"index": 0,
"message": "File sent successfully",
"fileName": "file_name_20231031123456.txt"
}
Error Response:
{
"index": null,
"message": "Empty file",
"fileName": null
}
Unexpected Error Response:
{
"message": "File upload failed",
"fileNames": null,
"files": null
}
Endpoint: POST /api/file/uploads
Description: Uploads multiple files at once.
Parameter:
files
: List of files to be sent of type File.
Successful Response:
{
"message": "Files sent successfully",
"fileNames": ["file_name_1.txt", "file_name_2.jpg"],
"files": [
{
"index": 0,
"originalFilename": "file_name_1.txt",
"downloadFilename": "file_name_1_202310311234560.txt",
"filename": "file_name_1",
"extension": ".txt"
},
{
"index": 1,
"originalFilename": "file_name_2.jpg",
"downloadFilename": "file_name_2_202310311234561.jpg",
"filename": "file_name_2",
"extension": ".jpg"
}
]
}
Error Response:
{
"message": "Empty list",
"fileNames": null,
"files": null
}
Unexpected Error Response:
{
"message": "Files upload failed",
"fileNames": null,
"files": null
}
Endpoint: POST /api/part/upload
Description: Uploads a single file of type Part.
Parameter:
part
: File to be sent of type File.
Successful Response:
{
"index": 0,
"message": "File sent successfully",
"fileName": "file_name_20231031123456.txt"
}
Error Response:
{
"index": null,
"message": "Empty file",
"fileName": null
}
Unexpected Error Response:
{
"message": "File upload failed",
"fileNames": null,
"files": null
}
Endpoint: POST /api/part/uploads
Description: Uploads multiple files at once.
Parameter:
parts
: List of files to be sent of type Part.
Successful Response:
{
"message": "Files sent successfully",
"fileNames": ["file_name_1.txt", "file_name_2.jpg"],
"files": [
{
"index": 0,
"originalFilename": "file_name_1.txt",
"downloadFilename": "file_name_1_202310311234560.txt",
"filename": "file_name_1",
"extension": ".txt"
},
{
"index": 1,
"downloadFilename": "file_name_2_202310311234561.jpg",
"filename": "file_name_2",
"extension": ".jpg"
}
]
}
Error Response:
{
"message": "Empty list",
"fileNames": null,
"files": null
}
Unexpected Error Response:
{
"message": "Files upload failed",
"fileNames": null,
"files": null
}
Endpoint: GET /api/file/download/{fileName}
Description: Downloads a specific file by its name.
Parameters:
fileName
: Name of the file to be downloaded.
Example request: GET /api/file/name_arquivo_1.txt
Answer: File_name_1.txt is downloaded as an attachment.
Endpoint: GET /api/file/downloads
Description: Downloads several files compressed in a zip file.
Parameters:
fileNames
: List of file names to be downloaded.
Example request: GET /api/file/downloads?fileNames=file_name_1.txt,file_name_2.jpg
Answer: The files file_name_1.txt and file_name_2.jpg are downloaded as an attachment compressed in a zip file.
- If no file is sent per parameter in the upload endpoints, the response will have the status HTTP 400 (Bad Request).
- If any file from the list passed in the multiple file download endpoint does not exist in the upload directory, it will be ignored in the zip file.
- If an unexpected error occurs during any of the processes, the response will have the status HTTP 500 (Internal Server Error).