2
votes

I am trying out the one drive graph api to upload folder to my one drive folder.

Using the regular upload works fine.

I'm also testing the resumable upload, which is used for large files. But this is where I'm getting a strange response.

I'm following this link for how to do it: https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_createuploadsession.

First i get a create an upload session using "https://graph.microsoft.com/v1.0/me/drive/items/xxxxxxxxxx:/filename.txt:/createUploadSession".

This gives me back an uploadUrl value, something like "https://api.onedrive.com/rup/xxxxxxxxxxxxx"

I then make a PUT request to that URL with the correct headers.

The response I receive is a 400 (bad request) with the following text (including the HTML):

<h2>Our services aren't available right now</h2><p>We're working to restore all services as soon as possible. Please check back soon.</p>Ref A: 235A863C95DC45BE98688D905A7DB3C1 Ref B: BUH01EDGE0107 Ref C: 2018-08-28T18:56:52Z

I have been getting this for 3 days now and I can't seem to get hold of any support from Microsoft. According to this website, everything is running: https://portal.office.com/servicestatus

Does anyone know why I'm getting this error?

1
How big is the payload you are uploading? Which headers are you sending? Are you seeing this for all resumable uploads, or just one/some?daspek
I've just tried 1 file. I'm setting ContentLength and ContentRange headers. I'm sending 116 bytes, that's my file size for now. Based on the response, i would assume my request is correct, and there is something wrong with the API. Are there other requirements as to how to send the data?Quintonn

1 Answers

0
votes

I found the cause for the error.

I received the error because I provided the authentication token in the header.

For small file uploads it is required, but for large file uploads it is not required.

I was using the same code for PUT, POST and GET requests, where I only pass in the URL and HTTP Content and i would always add the auth headers. But for large file uploads it is not required.

But still a very strange error response to receive for adding unrequired headers.