I am using jsforce for fetching ContentVersionData from a Node app. My query is SELECT VersionData FROM ContentVersion but instead of fetching the base64 value in VersionData field i m getting an url.

Let me know how to fetch base64 value of multiple ContentVersion in one go.

=========================Connection Code ================================

    let username = req.body.username;
    let password = req.body.password;
    const conn = new jsforce.Connection({
        loginUrl : 'https://test.salesforce.com/'
    await conn.login(username,password);
   req.conn = conn;


==================Query Code ======================================

let conventVersion = await sfConnection.query('SELECT VersionData FROM ContentVersion');
    conventVersion.records.forEach(ele=> {


=================Output Generated ========================

/services/data/v42.0/sobjects/ContentVersion/0685D000000YcdCQAS/VersionData /services/data/v42.0/sobjects/ContentVersion/0685D000000YcdbQAC/VersionData /services/data/v42.0/sobjects/ContentVersion/0685D000000Yd18QAC/VersionData /services/data/v42.0/sobjects/ContentVersion/0685D000000YdIYQA0/VersionData /services/data/v42.0/sobjects/ContentVersion/0685D000000YfhzQAC/VersionData


  • It's worth looking at the data model diagram of all the Contact Objects here and the ContentVersion tech docs – Brian Miller Jan 15 '20 at 10:48
  • Hi Brian , Thanks for quick response . Looked at both the link you shared but not able figure how to do the same. Can you help me out ? – AjSyles Jan 15 '20 at 10:59
  • 1
    Can you please provide a code of your connection query and the returned results? – Oleh Berehovskyi Jan 15 '20 at 11:20
  • Hi Oleh updated the post with code! – AjSyles Jan 15 '20 at 14:31

The reason for JSForce responding back with the URLs is because JSForce is using the REST API and that won't return back the Base64 content. Salesforce's SOAP API will however though when you issue a query with a Base64 field.

  • Thanks a lot Bryan it worked! – AjSyles Jan 16 '20 at 7:25
  • Bryan, Can you let me know how put Set of Ids in query string in SOAP API when we have large set of ids? Stuck on ContentDocumentLink – AjSyles Jan 16 '20 at 8:24
  • @AjSyles I would suggest looking at using the retrieve() SOAP API call to perform what you are looking for developer.salesforce.com/docs/atlas.en-us.api.meta/api/… – Bryan Anderson Jan 16 '20 at 15:48
  • Thanks a lot ! You are a saviour! – AjSyles Jan 16 '20 at 18:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.