gpt4 book ai didi

onedrive - Microsoft Graph API One Drive 无法读取 JSON 请求负载

转载 作者:行者123 更新时间:2023-12-04 17:04:33 26 4
gpt4 key购买 nike

当我调用 PUT API 以使用 Microsoft Graph API 将文档上传到 OneDrive 时,我收到以下错误。它早些时候工作,它突然停止工作。

{\r\n \"error\": {\r\n \"code\": \"BadRequest\",\r\n
\"message\": \"Unable to read JSON request payload. Please ensure Content-Type header is set and payload is of valid JSON format.\",\r\n \"innerError\": {\r\n \"request-id\": \"133ac360-740d-4823-9a93-1090616d925b\",\r\n \"date\": \"2016-04-11T06:24:59\"\r\n }\r\n }\r\n}

我正在执行的代码是

 using (var client = new HttpClient())
{
string url = https://graph.microsoft.com/v1.0/me/drive/root:/Test.xslx:/content
using (var request = new HttpRequestMessage(HttpMethod.Put, url))
{
string headerAcceptTest = "application/json";
MediaTypeWithQualityHeaderValue headerAccept = new MediaTypeWithQualityHeaderValue(headerAcceptTest);
request.Headers.Accept.Add(headerAccept);
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
request.Content = new ByteArrayContent(data);
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");

using (var response = await client.SendAsync(request))
{
if (response.StatusCode == HttpStatusCode.Created)
{
string responseContentAsString = await response.Content.ReadAsStringAsync();

}
}
}
}

知道我哪里出错了吗?

最佳答案

周末推出的新版本存在问题,我们现在已将其恢复。现在应该解决该问题。

关于onedrive - Microsoft Graph API One Drive 无法读取 JSON 请求负载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36543359/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com