Youtube可恢复上传400坏请求

时间:2014-02-21 11:57:22

标签: rest file-upload youtube youtube-api

我正在尝试使用rest api客户端进行可恢复的上传到youtube。 STEP-1:

https://www.googleapis.com/upload/youtube/v3/videos?uploadType=resumable&part=snippet,status,contentDetails

接头

Authorization        Bearer ya29.1.AADtN_UxUBz459k8HO_gropj2SW6ShlFsqBqJMXI3HVfcE4lKWkR-gq4_Tj0j6Oqb-oo_qnE
Content-Length       278
Content-Type         application/json; charset=UTF-8
X-Upload-Content-Length  1393167
x-upload-content-type    application/octet-stream

{
  "snippet": {
    "title": "My video title",
    "description": "This is a description of my video",
    "tags": ["cool", "video", "more keywords"],
    "categoryId": 22
  }
}

我收到了200 Ok的回复。我将提取用于进一步请求的URL。

步骤2:

https://www.googleapis.com/upload/youtube/v3/videos?uploadType=resumable&part=snippet,status,contentDetails&upload_id=AEnB2UqmDFhqQrOpbIgMp_E_bB6A3nP_Xb-DSiPHDUZRhz7usYMniFNASYeKoNrAktyPeXWLbLuz4fj1dUkaWg9cy9HQc-uKWA

接头

Authorization        Bearer ya29.1.AADtN_UxUBz459k8HO_gropj2SW6ShlFsqBqJMXI3HVfcE4lKWkR-gq4_Tj0j6Oqb-oo_qnE
Content-Length       1393167
Content-Type         application/octet-stream

VideoFile - abcd.mp4

当我尝试上传文件时,会返回400,并返回以下响应。

{
error: {
errors: [1]
0:  {
domain: "global"
reason: "badRequest"
message: "Invalid Upload Request"
}-
-
code: 400
message: "Invalid Upload Request"
}-
}

我尝试从各种客户端运行上述请求 - 高级REST API客户端和Google Chrome的Postman REST客户端,Java程序 - 在任何地方返回400.任何人都可以指出我在第2步中做了什么错误。这真的很有帮助。

0 个答案:

没有答案