OneDrive API createUploadSession“未找到API" [英] OneDrive API createUploadSession "API not found"

查看:110
本文介绍了OneDrive API createUploadSession“未找到API"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 onedrive api文档将大文件上传到OneDrive,首先创建一个上传会话,然后发送片段.一切都说得通,但是由于某种原因,它告诉我,当我尝试调用createUploadSession来启动该过程时,我的请求无效.

According to the onedrive api docs to upload large files to OneDrive, first you create an upload session, then you send the fragments. That all makes sense, but for some reason it's telling me that my request is invalid when I try the createUploadSession call to start the process.

在文档之后,它说请求uri必须遵循以下模式:POST /drive/root:/{path_to_item}:/createUploadSession

Following the documentation, it says the request uri must follow this pattern: POST /drive/root:/{path_to_item}:/createUploadSession

请求:

method: 'POST'
uri: 'https://api.onedrive.com/v1.0/drive/root:/testfile-lg-1488040561730.bin:/createUploadSession
headers: { Authorization: 'Bearer .....' }

响应:

status: 400
{ error: { code: 'invalidRequest', message: 'API not found' } }

我尝试了createUploadSession所有小写字母,所有大写字母等的各种组合.也许值得注意的是

I've tried various combinations of createUploadSession all lowercase, all uppercase, etc. It's perhaps worth noting that the small file <4MB simple file upload is working just fine.

推荐答案

OneDrive API文档最近已更新为引用Microsoft Graph,其语法略有不同.如果您正在调用OneDrive API(如示例中所示),则需要通过添加"oneDrive"对调用进行些微修改.动作名称的名称空间.

The OneDrive API documentation was recently updated to refer to Microsoft Graph, which has a slightly different syntax. If you are calling the OneDrive API, as it looks like in your sample, you need to modify the call slightly by adding the "oneDrive." namespace to the action name.

/oneDrive.createUploadSession

我们正在努力更新文档,以使其更加清晰.这里有更多详细信息: https://dev.onedrive.com/direct-endpoint- Differences.htm

We're working on updating the docs to make this more clear. There are more details here: https://dev.onedrive.com/direct-endpoint-differences.htm

这篇关于OneDrive API createUploadSession“未找到API"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆