如何更新项目在播放列表中的位置?
我使用API资源管理器:https://developers.google.com/youtube/v3/docs/playlistItems/update试试
:
片段请求主体:
{
"id": "12345",
"snippet":
{
"playlistId": "my_playlist_id",
"resourceId":
{
"kind": "youtube#video",
"videoId": "my_video_id"
},
"position": 3
}
}
反应:
403 Forbidden
Cache-Control: private, max-age=0
Content-Encoding: gzip
Content-Length: 125
Content-Type: application/json; charset=UTF-8
Date: Sun, 28 Apr 2013 14:23:37 GMT
Expires: Sun, 28 Apr 2013 14:23:37 GMT
Server: GSE
{
"error": {
"errors": [
{
"domain": "youtube.common",
"reason": "forbidden",
"message": "Forbidden"
}
],
"code": 403,
"message": "Forbidden"
}
}
我试过了,我认为API调用工作正常:
Request
PUT https://www.googleapis.com/youtube/v3/playlistItems?part=snippet%2CcontentDetails%2Cstatus&fields=id%2Csnippet&key={YOUR_API_KEY}
Content-Type: application/json
X-JavaScript-User-Agent: Google APIs Explorer
{
"id": "PLSvpjjbPJQDXYjfamKNrJHvyvkBfr7n1QwkVWH-4kWwk",
"snippet": {
"playlistId": "PLF-2B3_5y4x_yqhdqjdrXuse2AcK7i3XE",
"resourceId": {
"kind": "youtube#video",
"videoId": "MP1gvGcXcLk"
},
"position": 1
}
}
Response
200 OK
- Show headers -
{
"id": "PLSvpjjbPJQDXYjfamKNrJHvyvkBfr7n1QwkVWH-4kWwk",
"snippet": {
"publishedAt": "2013-03-01T16:33:20.000Z",
"channelId": "UC4_r417bYTsCoaVGgH1yYTg",
"title": "Amazing Google Glasses Demonstration at Google I/O 2012",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/MP1gvGcXcLk/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/MP1gvGcXcLk/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/MP1gvGcXcLk/hqdefault.jpg"
}
},
"channelTitle": "Matias Molinas",
"playlistId": "PLF-2B3_5y4x_yqhdqjdrXuse2AcK7i3XE",
"position": 1,
"resourceId": {
"kind": "youtube#video",
"videoId": "MP1gvGcXcLk"
}
}
}
可能是配额错误:
远程服务器返回一个错误:(403)Forbidden in Youtube api
HTTP 403响应可以与许多不同的错误相关联,并查看实际的响应HTTP正文(或异常中报告的序列化版本)。响应属性)是确定确切原因的唯一方法。
在执行上传时,一个非常常见的导致403的原因是配额错误。以下是更多细节: http://apiblog.youtube.com/2010/02/best-practices-for-avoiding-quota.html