OneDrive API createUploadSession “API not found”

2019-02-20 16:14发布

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.

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

request:

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

response:

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

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.

标签: api onedrive
1条回答
可以哭但决不认输i
2楼-- · 2019-02-20 16:34

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

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

查看更多
登录 后发表回答