问题
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