I’m trying to use “Try It!” on this page:
https://developers.google.com/youtube/v3/docs/videos/update
But I get Bad request error. Where should I set ID of the video I want to update? And what is the request format for updating video title or description?
The request format is to send a “video resource” JSON packet, which looks something like this:
When doing an update, you need only send the “id” and “kind” values, along with, in this case, a partial “snippet.” Be aware, however, that for writeable attributes — snippet.title, snippet.description, snippet.tags, snippet.categoryId, and status.privacyStatus — omitting them will have them revert to the default (‘public’ for privacyStatus, blank for the other 4). If you were to omit the categoryId, then, it results in a bad request, because it would be as if you were setting it to be in no category, and Youtube doesn’t allow a video to not have a category (this is, then, making categoryId a defacto required element). You also have to re-include the tags, the description, and the privacy status (unless you want it to default to public) so they won’t be cleared out. Thus to modify the title, you’d include the snippet, its title, and its category ID, like this: