问题相当简单,我无法对YouTube API视频提出非常简单的请求。我正在使用YouTube API Explorer(https://developers.google.com/youtube/v3/docs/videos/update)。该帐户已授权。其他API方法,例如playlists.update and Videos.List效果很好。请帮助此视频。update请求。
已发送测试请求:
PUT https://www.googleapis.com/youtube/v3/videos?part=snippet&key={YOUR_API_KEY}
Content-Type: application/json
Authorization: Bearer {AUTH_KEY}
X-JavaScript-User-Agent: Google APIs Explorer
{
"id": "{VIDEO_ID}",
"snippet": {
"title": "title change to test1",
"description": "description change to test"
}
}
收到的响应:
400 Bad Request
- Hide headers -
cache-control: private, max-age=0
content-encoding: gzip
content-length: 134
content-type: application/json; charset=UTF-8
date: Sun, 26 Jan 2014 18:48:13 GMT
expires: Sun, 26 Jan 2014 18:48:13 GMT
server: GSE
{
"error": {
"errors": [
{
"domain": "youtube.video",
"reason": "invalidRequest",
"message": "Bad Request"
}
],
"code": 400,
"message": "Bad Request"
}
}
似乎需要 spatiptoryid 属性,并且不记录您必须指定它。将此属性添加到请求正文中解决了问题。