Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update title and description using YouTube v3 API?

I successfully uploaded a video to YouTube using YouTube Data API v3. No third party libraries were used. Now I want to update the title and description of an uploaded video, but this seems impossible!

This should be a no-brainer, but YouTube refuses to accept this simple query:

curl --insecure -v -i -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer ACCESS_TOKEN_FROM_GOOGLE_HERE" -d '{"id":"YOUTUBE_VIDEO_ID_HERE","snippet":{"title":"My title","description":"My description","categoryId":"22"}}' "https://www.googleapis.com/youtube/v3/videos?part=snippet"

Even though I'm dead sure that the video does exist YouTube server responds with this:

{
 "error": {
  "errors": [
   {
    "domain": "youtube.video",
    "reason": "videoNotFound",
    "message": "The video that you are trying to update cannot be found. Check t
he value of the \u003ccode\u003eid\u003c/code\u003e field in the request body to
 ensure that it is correct.",
    "locationType": "other",
    "location": "body.id"
   }
  ],
  "code": 404,
  "message": "The video that you are trying to update cannot be found. Check the
 value of the \u003ccode\u003eid\u003c/code\u003e field in the request body to e
nsure that it is correct."
 }
}

Can somebody please show me the low-level commands (cannot use third party library) to successfully update the title and description of an uploaded video? Preferably using curl.

UPDATE:

I am able to delete the file using the delete API. Hence, the ID is indeed correct.

like image 793
l33t Avatar asked Oct 01 '22 06:10

l33t


1 Answers

It looks like you might be missing the "kind" value.

curl --insecure -v -i -X PUT -H "Content-Type: application/json" -H "Authorization:  Bearer ACCESS_TOKEN_FROM_GOOGLE_HERE" -d '{"id":"YOUTUBE_VIDEO_ID_HERE","kind":"youtube#video","snippet":{"title":"My title","description":"My description","categoryId":"22"}}' "https://www.googleapis.com/youtube/v3/videos?part=snippet"
like image 111
vangheem Avatar answered Oct 12 '22 10:10

vangheem