I am trying to get the onedrive drive properties using the office 365 REST API but i am getting the response as false when i var_dump my response. Below is my code.
$file_api = "https://{tenant}-my.sharepoint.com/_api/v1.0/me/drive/files";
$headers = array(
'Content-Type: application/json',
'Authorization: Bearer'.$token, // Always need our auth token!
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $file_api);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
var_dump($result);
Can anyone tell me what am i doing wrong here ?
I am referencing this link.
Respone is
array (
'url' => 'https://{tenant}-my.sharepoint.com/_api/v1.0/me/drive/files',
'content_type' => NULL,
'http_code' => 0,
'header_size' => 0,
'request_size' => 0,
'filetime' => -1,
'ssl_verify_result' => 0,
'redirect_count' => 0,
'total_time' => 30.749314999999999,
'namelookup_time' => 0.20429800000000001,
'connect_time' => 0.20474100000000001,
'pretransfer_time' => 0,
'size_upload' => 0,
'size_download' => 0,
'speed_download' => 0,
'speed_upload' => 0,
'download_content_length' => -1,
'upload_content_length' => -1,
'starttransfer_time' => 0,
'redirect_time' => 0,
'redirect_url' => '',
'primary_ip' => '104.146.150.43',
'certinfo' =>
array (
),
'primary_port' => 443,
'local_ip' => '192.168.8.46',
'local_port' => 54470,
)
Thanks in advance