Re: Rest API - need help in sending attachment
Hi Johan, Thank you for the suggestion. I will try this out. It would be better if there's something at framework level that avoids the extra implementation as the attachments are very much needed in the application. On Thu, Apr 14, 2022, 12:51 Johan Cronje wrote: > Hi Rishi, > > A suggestion that I have used previously was to encode a file as > base64, send it as part of the JSON body and rebuild it within a java > service, this way multiple files can also be uploaded: > { > "files": [ > { > "file_name": "fileName.pdf", > "content_type": "application/pdf", > "file_content": "base64 encoded string of file content" > } > ] > } > > There may be better suggestions > > Kind Regards, > Johan > > On Thu, 14 Apr 2022 at 08:25, Rishi Agr wrote: > > > > Hi, > > I am trying to send attachment in a post request and I am unable to. I've > > used multipart/* as the consumer content-type and it's not working. I > tried > > to debug and found that post request takes only application/json. The > > OPTIONS request had all the types supported and I tried that as well. > Added > > a switch case for OPTIONS in apply method of RestRequestHandler class but > > was not successful. Can someone please let me know how can I achieve > this? > > Thank you. Rishi >
Re: Rest API - need help in sending attachment
Hi Rishi, A suggestion that I have used previously was to encode a file as base64, send it as part of the JSON body and rebuild it within a java service, this way multiple files can also be uploaded: { "files": [ { "file_name": "fileName.pdf", "content_type": "application/pdf", "file_content": "base64 encoded string of file content" } ] } There may be better suggestions Kind Regards, Johan On Thu, 14 Apr 2022 at 08:25, Rishi Agr wrote: > > Hi, > I am trying to send attachment in a post request and I am unable to. I've > used multipart/* as the consumer content-type and it's not working. I tried > to debug and found that post request takes only application/json. The > OPTIONS request had all the types supported and I tried that as well. Added > a switch case for OPTIONS in apply method of RestRequestHandler class but > was not successful. Can someone please let me know how can I achieve this? > Thank you. Rishi
Rest API - need help in sending attachment
Hi, I am trying to send attachment in a post request and I am unable to. I've used multipart/* as the consumer content-type and it's not working. I tried to debug and found that post request takes only application/json. The OPTIONS request had all the types supported and I tried that as well. Added a switch case for OPTIONS in apply method of RestRequestHandler class but was not successful. Can someone please let me know how can I achieve this? Thank you. Rishi