Handling file attachments with REST
The Genero REST high-level framework provides two mechanisms for handling attachments.
- Send (or receive) the complete file as a simple attachment.
- Send (or receive) a file in a MIME multipart message body.
Which method to use
Situation | Method to choose |
---|---|
If your REST service needs one file, whether it is a zip file, image, or PDF. | Send the complete file as a simple attachment. |
If the design of your REST Web services requires multipart to attach files. | Send the file as multipart. |
If you have several attachments to send in a single HTTP request or response message. | Send the file as multipart. |
If you have a large data object, whether it is a binary, text file, or a BLOB in a database. | Send the data in a BYTE or TEXT object in the message body. See Transfer data in large objects |