• Neil Kolban
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 0
    Replies
When reading the challenge called "Write SOSL Queries", I read that one of the requirements is:

The return type for 'searchContactsAndLeads' must be 'List<List< SObject>>'

I believe this contains a simple couple of typos and should actually be:

The return type for 'searchContactsAndLeads' must be 'List<List<sObject>>'
I am running the following function in PHP
function get_specific_record ( $field_query, $field_return, $sf_object_type ) {
        $query = "SELECT Id, $field_return FROM $sf_object_type WHERE $field_query";
        
        $url = "$this->instance_url/services/data/$this->api_version/query?q=" . urlencode($query);
        $curl = curl_init($url);
        
        curl_setopt_array ($curl, $this->curl_standard_options);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        $json_response = curl_exec($curl);
        curl_close($curl);
    
        $response = json_decode($json_response);
        
        if ($response->totalSize > 0) {
            return $response;
        }
        // returns fales if no matching record type is found
        return false;
}

$field_query = "ContentDocumentId = '{IdEnteredHere}'";
$field_return = 'VersionData';
$attachments = $fc->get_specific_record( $field_query, $field_return, 'ContentVersion');
The result comes out as:
stdClass Object
(
    [totalSize] => 1
    [done] => 1
    [records] => Array
        (
            [0] => stdClass Object
                (
                    [attributes] => stdClass Object
                        (
                            [type] => ContentVersion
                            [url] => /services/data/v37.0/sobjects/ContentVersion/{IdEntered}
                        )

                    [Id] => {IdEntered}
                    [VersionData] => /services/data/v37.0/sobjects/ContentVersion/{IdEntered}/VersionData
                )

        )

)
If running similar query in Workbench SOQL Query, it'll return the data but otherwise it only returns the path. Any ideas of what I need to do in order to retrieve the data in VersionData?