SUCCESSFUL RESPONSE BUT CANT RETRIEVE INNER FOLDERS & DOCUMENTS - PLEASE HELP ASAP!!

  • 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";

//https://account.sf-api.com/sf/v3/Items(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";
}
 


$item=get_item_by_id($token,'fohd08e9-3403-4d45-a31d-48b0869b6a0d');
 
 echo " <h1>Item Details</h1> -- <pre>";
 print_r($item);
 echo "</pre>";
 
// echo "Users <pre>"; print_r($users);
 //https://".$this->get_hostname($token)."/sf/v3/Items(".$folder_id.")/Upload&am...
// https://account.sf-api.com/sf/v3/Shares
// exit;

/* echo" All -- <pre>";
print_r($token);
echo "</pre>";  */

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

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 https://api.sharefile.com/rest/docs/resource.aspx?name=Items
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');
(Edited)