我试图使用Youtube API资源管理器在我的频道上设置视频内宣传,以此作为概念证明,然后再将其写入网络应用。我正在研究从https://developers.google.com/youtube/v3/code_samples/java#add_a_featured_video添加精选视频的Java示例。我无法解决此错误代码:
"error": {
"errors": [
{
"domain": "youtube.common",
"reason": "forbidden",
"message": "Access forbidden. The request may not be properly authorized.",
"locationType": "other",
"location": "body.invideoPromotion.item.websiteUrl"
}
],
"code": 403,
"message": "Access forbidden. The request may not be properly authorized."
}
这是我的要求:
PUT https://www.googleapis.com/youtube/v3/channels?part=invideoPromotion&key={YOUR_API_KEY}
{
"invideoPromotion": {
"defaultTiming": {
"type": "offsetFromStart",
"offsetMs": "15001"
},
"items": [
{
"customMessage": "test message",
"id": {
"websiteUrl": "https://google.com",
"type": "website"
}
}
],
"useSmartTiming": true
},
"id": "<channel id recieved from earlier request in the java example>"
}
我正在使用Oauth2授权请求,并选择所有可用的youtube范围。错误代码似乎表明存在更多特定于更新频道操作的作用域,但我在文档中只能找到6个常规youtube作用域。