+ Start a Discussion
Pedram SalehPedram Saleh 

Querying VersionData from ContentVersion returns URL when querying using React Native SDK

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

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

Any idea why this could be and how to get the data I want?  Thanks.
Have you tried using a different API version instead of 36? Maybe a 30?
Pedram SalehPedram Saleh
Changed it to 30.0 in the URL and also in REST Explorer and the results were the same.
Not sure how to do it in the React Native app, since that was created using forceios.
Pedram SalehPedram Saleh
OK so there's a way in the SF RN library code to be able to hard code the API version (it was set to 36). I tried that, but it doesn't fix the problem; it just changes the number in the url I get back.
Pedram SalehPedram Saleh
Just to clarify, when I query it using REST Explorer with the following format, I still get just the URL back


When I run the exact same query from the Workbench SOQL query tool it gives me the data I want. 

Even using the SobjContainer component in React Native gives me Description, FileType, ID, OwnerID, TagCsv, Title, __shortID, _soupEntryID, _soupLastModifiedDate - and the attributes of CompactTitle, shortID, type, and url. Basically everything except VersionData.
Sweta C 10Sweta C 10
Hi Pedram, Is this issue resolved for you? because I am facing the same issue. I want to get the version data in 64-bit format
Susand AdameSusand Adame
I tested it on this website https://naughtyfriendgirl.com/ and i get the same error.