Reputation: 19937
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.
I am able to delete the file using the delete API. Hence, the ID is indeed correct.
Upvotes: 6
Views: 4557
Reputation: 19937
Not sure why, but if I include the entire json
response from the actual upload, it works. That is, to update the description I do the following:
Hence, updating using a stripped down json does not seem to work.
Upvotes: -1
Reputation: 3293
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"
Upvotes: 6