2014-01-26 66 views
3

这个问题相当简单,我不能提出一个非常简单的请求youtube api video.update,但没有得到400响应的原因'invalidRequest'。我使用Youtube API Explorer(https://developers.google.com/youtube/v3/docs/videos/update)。该帐户已获得授权。其他API方法,如playlists.update和videos.list工作得很好。请帮助这个video.update请求。Youtube API v3 video.update 400 - invalidRequest

测试请求发送:收到

PUT https://www.googleapis.com/youtube/v3/videos?part=snippet&key={YOUR_API_KEY} 

Content-Type: application/json 
Authorization: Bearer {AUTH_KEY} 
X-JavaScript-User-Agent: Google APIs Explorer 

{ 
"id": "{VIDEO_ID}", 
"snippet": { 
    "title": "title change to test1", 
    "description": "description change to test" 
} 
} 

响应:

400 Bad Request 

- Hide headers - 

cache-control: private, max-age=0 
content-encoding: gzip 
content-length: 134 
content-type: application/json; charset=UTF-8 
date: Sun, 26 Jan 2014 18:48:13 GMT 
expires: Sun, 26 Jan 2014 18:48:13 GMT 
server: GSE 

{ 
"error": { 
    "errors": [ 
    { 
    "domain": "youtube.video", 
    "reason": "invalidRequest", 
    "message": "Bad Request" 
    } 
    ], 
    "code": 400, 
    "message": "Bad Request" 
} 
} 

回答

4

好像snippet.categoryId属性是必需的,它没有记录,你必须指定它。将此属性添加到请求主体解决了问题。

+0

是的,谢谢。我的头靠在墙上撞了很长时间。这确实需要在他们的文档中。 – tobek