• Sweta C 10
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
I'm trying to query VersionData to get a base64 representation of a file. It works in workbench for the below query:
SELECT Id, (SELECT ID, ContentDocument.LatestPublishedVersion.VersionData FROM ContentDocumentLinks) From Case

(I get a really long field) of version data in 64-bit via workbench

but when I query it in my Postman I just get the following as

/services/data/v36.0/sobjects/ContentVersion/{id of file}/VersionData
I was trying to get VersionData from ContentDocumentLink Object directly in one SOQL query instead of working on two seperate queries in a batch via API.
was trying this :SELECT Id, (SELECT ID, ContentDocument.LatestPublishedVersion.VersionData FROM ContentDocumentLinks) FROM Case
It gives version data in Workbench but doesn't give it in API response.
Appreciate the help.
Thanks, Sweta
I'm trying to query VersionData to get a base64 representation of a file. It works in workbench (I get a really long field), but when I query it in my React Native sample app created with forceios (using SDK 4.3) I just get the following as the result:

/services/data/v36.0/sobjects/ContentVersion/{id of file}/VersionData

When I paste that URL into REST Explorer and do a get, I just get:

Raw Response
1


If I log into salesforce.com and paste that url after the .com, I get the following:
 
<Errors>
  <Error>
    <errorCode>INVALID_SESSION_ID</errorCode>
    <message>Session expired or invalid</message>
  </Error>
</Errors>

Any idea why this could be and how to get the data I want?  Thanks.