GithubHelp home page GithubHelp logo

filetransfer's Introduction

Visitors

Documentação em Português: link

Documentation in English below

File transfer

🗂 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.

Summary

  • 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
  • Comments
  • Contact

Endpoints for File type files

Single File Upload

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
}

Multiple File Upload

File type files

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
}

Endpoints for Part type files

Single File Upload

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
}

Multiple File Upload

Part type files

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
}

File Download

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.

Download Multiple Files in One Zip File

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.

General observations

  • 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).

Contact

Made with ❤️ by Leonardo Aragão 👋🏻 Get in touch!

Profile photo of Leonardo Aragão author of the FileTransfer API

filetransfer's People

Contributors

lewoaragao avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.