OneDrive API createUploadSession “API not found”

久未见 提交于 2019-12-30 11:55:28

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/42458796/onedrive-api-createuploadsession-api-not-found

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!