We use salesforce to create different cases and we can attach the docs to a case as well.

Now, i have to retrieve the attached doc from a case using REST API. I have used below query

"SELECT  Body FROM Attachment " +"WHERE ParentId='"+caseId+"' AND Name='" + filename + "'";

The query returns "/services/data/v30.0/sobjects/Attachment/00PJ0000003PoLWMA0/Body" as output which is path of file. But i am expecting a byte stream to be returned.

What shall i do to get the byte array?

1 Answer 1


You need a subsequent API call to get the binary content.

curl https://na1.salesforce.com/services/data/v20.0/sobjects/Attachment/001D000000INjVe/body -H "Authorization: Bearer token"

More details here.

You must log in to answer this question.

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