我正在尝试使用rest api客户端进行可恢复的上传到youtube。 STEP-1:
接头
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:
接头
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步中做了什么错误。这真的很有帮助。