• vinh nguyen 44
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies

Hi everyone,

I'm doing a rest call to retrieve attachments out of Salesforce. The first call would get the information of the attachment which has the URL to the body of the attachment. From there, I take the URL of the body and do another call to retrieve the contents of the attachment.

The calls are successful, however, when getting a response back, the response.getBody() return a string that does not translate to anything. When saving to a file or reuploading or encoding it, it always ends up to be gibberish or a broken file.

 

My questions are:

 what kind of content does the GET method return for the URL: https://SOME_ORG.salesforce.com/services/data/v20.0/sobjects/Attachment/SOME_ID/body

Am I missing anything to get the correct format? The headers that are being included in the final call for my attachment body are Content-Type, Authoriatization, and Accept

 

I also forgot to mention that postman is able to retrieve and display the content just fine. The issue is that the rest call returns a binary string and I am unable to translate it back to the actual content itself.

Hi everyone,

I'm doing a rest call to retrieve attachments out of Salesforce. The first call would get the information of the attachment which has the URL to the body of the attachment. From there, I take the URL of the body and do another call to retrieve the contents of the attachment.

The calls are successful, however, when getting a response back, the response.getBody() return a string that does not translate to anything. When saving to a file or reuploading or encoding it, it always ends up to be gibberish or a broken file.

 

My questions are:

 what kind of content does the GET method return for the URL: https://SOME_ORG.salesforce.com/services/data/v20.0/sobjects/Attachment/SOME_ID/body

Am I missing anything to get the correct format? The headers that are being included in the final call for my attachment body are Content-Type, Authoriatization, and Accept

 

I also forgot to mention that postman is able to retrieve and display the content just fine. The issue is that the rest call returns a binary string and I am unable to translate it back to the actual content itself.