【问题标题】:Youtube API v3 video.update response 400 - invalidRequestYoutube API v3 video.update 响应 400 - invalidRequest
【发布时间】:2014-01-26 19:01:55
【问题描述】:

问题很简单,我无法向 youtube api video.update 发出非常简单的请求,而不会收到 400 响应,原因是“invalidRequest”。我正在使用 Youtube API Explorer (https://developers.google.com/youtube/v3/docs/videos/update)。该帐户已授权。其他 API 方法,例如 playlists.update 和 videos.list 也可以正常工作。请帮忙处理这个 video.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"
 }
}

【问题讨论】:

    标签: youtube-api http-status-code-400


    【解决方案1】:

    似乎 sn-p.categoryId 属性是必需的,并且没有记录您必须指定它。将此属性添加到请求正文中解决了问题。

    【讨论】:

    • 是的,谢谢。把我的头撞在墙上好久了。这确实需要在他们的文档中。
    猜你喜欢
    • 1970-01-01
    • 2014-06-29
    • 2014-09-22
    • 2015-07-21
    • 2017-06-08
    • 2019-09-06
    • 2013-01-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多