YouTube Subscriptions: insert fails with error 400

此生再无相见时 提交于 2019-12-24 22:16:17

问题


I want to subscribe for a specific channel, to achieve this I use their official docs. There is a Execute button right on top page:

That supposed to demonstrate the request, after I grant access it throws an error:

    /**
 * 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."
  }
}

But the request body contains snippet.resourceId :

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

回答1:


I just figured it out! To make it work we have to insert a value into snippet.resourceId.channelId gap, even if it already have one. I just copy/pasted the same value and bum code 200 and I was subscribed to google channel.



来源:https://stackoverflow.com/questions/49011575/youtube-subscriptions-insert-fails-with-error-400

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!