Hi,
I'm trying to search for a file uploaded in my Dropbox APP using the following code:
$data = json_encode(array("path" => "/", "query" => $this->filename, "mode" => "filename"));
$url = 'https://api.dropboxapi.com/2/files/search';
$headers = array('Authorization: Bearer '.$GLOBALS['access_token'],
'data: '.$data,
'Content-Type: application/json');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_PUT, true);
// Turn off the server and peer verification (TrustManager Concept).
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Get response from the server.
$resp = curl_exec($ch);
echo '<br />Curl Response: ';
print_r($resp);
curl_close($ch);
I'm getting the curl response as:
Error in call to API function "files/search": request body: could not decode input as JSON
Please tell me what correction needs to be done.