Reputation: 1686
Is it possible to delete a youtube video using API V3 with just the Video id and Key? I keep getting an error about a "Required parameter: part" missing. I tried it with the Server and Browser api key Here is my code:
// $youtube_id = the ID string and $key = the Key for browser applications
$delete_string = "https://www.googleapis.com/youtube/v3/videos?id=" . $youtube_id ."&key=" . $key;
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$delete_string);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_HEADER, true);
$output=curl_exec($ch);
curl_close($ch)
I get the error:
{ "error": { "errors": [ { "domain": "global", "reason": "required", "message": "Required parameter: part", "locationType": "parameter", "location": "part" } ], "code": 400, "message": "Required parameter: part" } }
Upvotes: 1
Views: 97
Reputation: 3935
Your missing the HTTP Verb, maybe this causes this error too.
Try adding this:
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
By the way, maybe you'll want to use a php api for that like google-api-php-client, so you don't have to reinvent everything.
Upvotes: 1