YouTube订阅:插入失败,错误400

时间:2018-02-27 14:54:19

标签: youtube youtube-api youtube-data-api

我想订阅一个特定的频道,为了达到这个目的,我使用他们的official docs。首页右侧有一个执行按钮enter image description here

那应该演示请求,在我授予访问权限之后会抛出错误:

    /**
 * API response
 */
{
  "error": {
    "errors": [
      {
        "domain": "youtube.subscription",
        "reason": "publisherRequired",
        "message": "The subscription resource specified in the request must use the snippet.resourceId property to identify the channel that is being subscribed to."
      }
    ],
    "code": 400,
    "message": "The subscription resource specified in the request must use the snippet.resourceId property to identify the channel that is being subscribed to."
  }
}

但请求正文包含snippet.resourceId

{"0":{"name":"snippet.resourceId.kind","value":"youtube#channel"},"1":{"name":"snippet.resourceId.channelId","value":"UC_x5XG1OV2P6uZZ5FSM9Ttw"}}

1 个答案:

答案 0 :(得分:-1)

我刚想通了!为了使其工作,我们必须在snippet.resourceId.channelId间隙中插入一个值,即使它已经有一个。我只是复制/粘贴相同的值和bum代码200,我订阅了谷歌频道。

enter image description here