How to send a file from one app to another

I want to send a file(pdf, jpg,png,,jpeg) which is uploaded in one application (say A) to be sent to another application(say B). i.e., The file in A should go to B.    
3 answers

The easiest way to do this would be to:

  1. Encode the filedocument in Base64 in the sending application
  2. Add those contents to your REST message (as a string)
  3. Send the message
  4. In the receiving application, decode from Base64
  5. Create the filedocument. 

You can publish a service that gives a System.FileDocument type of response.
In your service;
- Retrieve file document that you want to send
- If found, return that object
- Otherwise, adjust your httpResponse and send empty object


You are asking for a solution to share files. To be honest, sharing files via API is not a common way.

Better and more easy is to use a shared file storage system (e.g. Amazon S3) use this for both applications. You can use the FTP (file transfer protocol) to upload/download files. All files changes are directly available for both apps.