• 1
  • Problem
  • Updated 6 days ago
We are getting a successful response after calling the API in PHP with your HTTP method. However within the Personal Folders we have the folders showing with no documents. And in the Shared Folders we have no Folders and no documents showing. Can you please review our Code where we are calling the ITEM ID by your LINK for GET ITEM BY ID ?? We really would appreciate your support please please help us. Our client has a pretty big account with you guys and must have this integrated.

function get_item_by_id($token, $item_id) {
   // $uri = "https://".get_hostname($token)."/sf/v3/Items(".$item_id.")";
    $uri = "https://".get_hostname($token)."/sf/v3/Items(".$item_id.")/Children";


    echo "GET ".$uri."\n";
    $headers = get_authorization_header($token);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $uri);
    curl_setopt($ch, CURLOPT_TIMEOUT, 30);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_VERBOSE, FALSE);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    $curl_response = curl_exec ($ch);
    $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    $curl_error_number = curl_errno($ch);
    $curl_error = curl_error($ch);
    //echo $curl_response."\n"; // output entire response
    echo $http_code."\n"; // output http status code
    curl_close ($ch);
    $root = json_decode($curl_response);
    //print_r($root); // print entire json response
    echo $root->Id." ".$root->CreationDate." ".$root->Name."\n";

 echo " <h1>Item Details</h1> -- <pre>";
 echo "</pre>";
// echo "Users <pre>"; print_r($users);
// exit;

/* echo" All -- <pre>";
echo "</pre>";  */

if($token) {
    get_root($token, TRUE);
Photo of Vick


  • 17 Posts
  • 0 Reply Likes

Posted 1 month ago

  • 1
Photo of Luke Skrzypek

Luke Skrzypek, Employee

  • 21 Posts
  • 3 Reply Likes
Please see the Download call documentation here
Depending on what you set the "redirect" url parameter to (true/false), the API will either:
1) For redirect=true; respond with a 302 redirect response and redirect you to the download link. 
2) For redirect=false; return a download url in the response content. It's then up to you to download the file from this new url.

Also, at a glance you seem to be passing four parameters to the "download_item" when it only takes three:

download_item($token, 'fi433fe6-9ee3-b76a-61ea-7b80fd69dd53',$_GET['download'], $local_path='C:\Users\murali\Downloads');