2

How to post a file in binary format to a RESTful web service?

Any suggestions will be appreciated.

Thanks in advance

1 Answer 1

3

Use the setBodyAsBlob function to specify binary data for a transfer. Make sure you set the appropriate message (e.g. POST, PUT).

2
  • Thanks for the answer. Can you help me in "how to post a file to a RESTful web service in apex?" Is it possible to send a file in Salesforce through Rest service POST call or is it limited to send only the content?
    – sfdc5000
    Commented Aug 10, 2015 at 2:08
  • @sfdc5000 Not sure I understand the question. What type of file are you trying to send? You can send any binary data you have access to, up to the maximum governor limit for sending binary data (6MB/12MB).
    – sfdcfox
    Commented Aug 10, 2015 at 2:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .