Reputation: 1
When I run 'https://www.googleapis.com/drive/v3/files' successfully works
However if I try 'https://www.googleapis.com/drive/v3/files/{fileId}/copy' it returns a 404 Error
The same example, If I Try on 'Drive Explorer Try Now', it works fine there as well. So what's wrong not able to figure out
$url = 'https://www.googleapis.com/drive/v3/files/1ZYyl0MzfWy_V5Io3N0BTsF19pNiX7s23BqYPbQKplvU/copy';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer '. $access_token));
$data = json_decode(curl_exec($ch), true);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if($http_code != 200)
throw new Exception('Error : Failed');
return $data;
Upvotes: 0
Views: 666
Reputation: 117086
404 not found means just that that the end point you are trying is not found.
But your copy does not work and you say you have checked that its the same file i did.
I wonder Copy is a http Post request did you forget to send it as a post?
curl_setopt($ch, CURLOPT_POST, 1);
Upvotes: 0