400在Windows Phone 8.1中使用REST API将视频上载到youtube时出现错误请求

400在Windows Phone 8.1中使用REST API将视频上载到youtube时出现错误请求,rest,windows-runtime,youtube-api,windows-phone-8.1,dotnet-httpclient,Rest,Windows Runtime,Youtube Api,Windows Phone 8.1,Dotnet Httpclient,下面是我在WindowsPhone8.1中使用RESTAPI将视频上传到youtube的代码。我跟随了来自中国的向导。它返回400个错误请求,错误为JSON(在代码后面给出)。有人知道我的代码出了什么问题吗 公共异步任务上载VideoAsync(令牌AuthToken) { 字符串json=@”{ “片段”:{ “”标题“”:“”使用API“”, “”描述“”:“”这是对我的视频“”的描述, “”标签“”:[“酷”、“视频”、“更多关键字”“], “类别ID”:21, }, “状态”:{ “pr

下面是我在WindowsPhone8.1中使用RESTAPI将视频上传到youtube的代码。我跟随了来自中国的向导。它返回400个错误请求,错误为JSON(在代码后面给出)。有人知道我的代码出了什么问题吗

公共异步任务上载VideoAsync(令牌AuthToken)
{
字符串json=@”{
“片段”:{
“”标题“”:“”使用API“”,
“”描述“”:“”这是对我的视频“”的描述,
“”标签“”:[“酷”、“视频”、“更多关键字”“],
“类别ID”:21,
},
“状态”:{
“privacyStatus”:“public”,
“可嵌入”:True,
“”许可证“”:“”youtube“”
}
}";
var JsonReqMsg=新的HttpStringContent(json);
JsonReqMsg.Headers.ContentType=新的Windows.Web.Http.Headers.HttpMediaTypeHeaderValue(“应用程序/json”)
{
CharSet=“UTF-8”
};
ulong ReqSize=0;
JsonReqMsg.TryComputeLength(超出要求尺寸);
JsonReqMsg.Headers.ContentLength=ReqSize;
var videoFile=await StorageFile.getfilefromApplicationUrisync(新Uri(“ms”)-appx:///Assets/test.mp4"));
var prop=await videoFile.GetBasicPropertiesAsync();
var request=newhttprequestmessage(HttpMethod.Post,新Uri(“https://www.googleapis.com/upload/youtube/v3/videos?uploadType=resumable&part=snippet);
request.Headers.Add(“X-Upload-Content-Length”,prop.Size.ToString());
request.Headers.Add(“x-upload-content-type”、“video/*”);
Content=JsonReqMsg;
var httpClient=新的httpClient();
httpClient.DefaultRequestHeaders.Add(“授权”,AuthToken.TokenType+“”+AuthToken.AccessToken);
var UploadReq=wait httpClient.SendRequestAsync(请求);
if(UploadReq.IsSuccessStatusCode)
{
string\u VideoUrl=string.Empty;
var res=await UploadReq.Content.ReadAsStringAsync();
UploadReq.Headers.TryGetValue(“位置”,out\u VideoUrl);
var binaryContent=newhttpbuffercontent(wait FileIO.ReadBufferAsync(videoFile));
var UploadReq=等待httpClient.PutAsync(新Uri(\u VideoUrl),二进制内容);
if(上传请求\发布成功状态码)
{
var res_u3;=wait UploadReq_3;Content.ReadAsStringAsync();
}
}
}
错误JSON

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "parseError",
    "message": "Parse Error"
   }
  ],
  "code": 400,
  "message": "Parse Error"
 }
}

YouTube API文档在示例JSON请求中出错
categoryId
值将是
string
而不是
int
可嵌入的
键具有True作为值。它应该是
true
,没有资本T

请同时查看以下内容: