When creating an upload session for a file that was previously downloaded and for which I have a driveId, I only get 400 responses "bad request", no matter what options or properties:
session = getClient().getMe().getDrive().getItems(_fileId).getCreateUploadSession(props).buildRequest(options).post();
See logging below.
But creating an upload session by using a path based id to the same file, it works OK.
session = getClient().getMe().getDrive().getRoot().getItemWithPath(driveId).getCreateUploadSession(props).buildRequest(options).post();
Basically it seems that this does not work:
POST /me/drive/items/{itemId}/createUploadSession
although it should according to the API documentation.
Any work around for that? I'd rather use driveIds for syncing than path based ids
Log for 400 error:
D/MSAAuthAndroidAdapter[authenticateRequest] - 94: Authenticating request, https://graph.microsoft.com/v1.0/me/drive/items/B10591ECE6B59AC8!148/microsoft.graph.createUploadSession?%40microsoft.graph.conflictBehavior=replace D/MSAAuthAndroidAdapter[getAccessToken] - 120: Found account information D/DefaultHttpProvider[sendRequestInternal] - 226: Starting to send request, URL https://graph.microsoft.com/v1.0/me/drive/items/B10591ECE6B59AC8!148/microsoft.graph.createUploadSession?%40microsoft.graph.conflictBehavior=replace D/DefaultHttpProvider[sendRequestInternal] - 230: Request Method POST D/DefaultHttpProvider[sendRequestInternal] - 246: Sending com.microsoft.graph.extensions.DriveItemCreateUploadSessionBody as request body D/DefaultSerializer[serializeObject] - 92: Serializing type DriveItemCreateUploadSessionBody D/DefaultHttpProvider[sendRequestInternal] - 281: Response code 400, Bad Request D/DefaultHttpProvider[sendRequestInternal] - 292: Handling error response D/DefaultSerializer[serializeObject] - 92: Serializing type DriveItemCreateUploadSessionBody D/DefaultSerializer[deserializeObject] - 71: Deserializing type GraphErrorResponse E/DefaultHttpProvider[sendRequestInternal] - 333: OneDrive Service exception POST https://graph.microsoft.com/v1.0/me/drive/items/B10591ECE6B59AC8!148/microsoft.graph.createUploadSession?%40microsoft.graph.conflictBehavior=replace SdkVersion : graph-android-v1.7.0 E/DefaultHttpProvider[sendRequestInternal] - 333: Authorization : bearer EwBYA8l6BAAURSN/FHlDW5xN74t[...] {"item":{}} 400 : Bad Request
Hi everyone,
Thank you for the contribution, we have moved away from an android specific SDK to a Java SDK and this repo will be archived very soon.
If you're still facing the same issue with the Java SDK, feel free to re-open an issue over there.
Closing.
When creating an upload session for a file that was previously downloaded and for which I have a driveId, I only get 400 responses "bad request", no matter what options or properties:
session = getClient().getMe().getDrive().getItems(_fileId).getCreateUploadSession(props).buildRequest(options).post();
See logging below. But creating an upload session by using a path based id to the same file, it works OK.session = getClient().getMe().getDrive().getRoot().getItemWithPath(driveId).getCreateUploadSession(props).buildRequest(options).post();
Basically it seems that this does not work:
POST /me/drive/items/{itemId}/createUploadSession
although it should according to the API documentation. Any work around for that? I'd rather use driveIds for syncing than path based idsLog for 400 error:
D/MSAAuthAndroidAdapter[authenticateRequest] - 94: Authenticating request, https://graph.microsoft.com/v1.0/me/drive/items/B10591ECE6B59AC8!148/microsoft.graph.createUploadSession?%40microsoft.graph.conflictBehavior=replace D/MSAAuthAndroidAdapter[getAccessToken] - 120: Found account information D/DefaultHttpProvider[sendRequestInternal] - 226: Starting to send request, URL https://graph.microsoft.com/v1.0/me/drive/items/B10591ECE6B59AC8!148/microsoft.graph.createUploadSession?%40microsoft.graph.conflictBehavior=replace D/DefaultHttpProvider[sendRequestInternal] - 230: Request Method POST D/DefaultHttpProvider[sendRequestInternal] - 246: Sending com.microsoft.graph.extensions.DriveItemCreateUploadSessionBody as request body D/DefaultSerializer[serializeObject] - 92: Serializing type DriveItemCreateUploadSessionBody D/DefaultHttpProvider[sendRequestInternal] - 281: Response code 400, Bad Request D/DefaultHttpProvider[sendRequestInternal] - 292: Handling error response D/DefaultSerializer[serializeObject] - 92: Serializing type DriveItemCreateUploadSessionBody D/DefaultSerializer[deserializeObject] - 71: Deserializing type GraphErrorResponse E/DefaultHttpProvider[sendRequestInternal] - 333: OneDrive Service exception POST https://graph.microsoft.com/v1.0/me/drive/items/B10591ECE6B59AC8!148/microsoft.graph.createUploadSession?%40microsoft.graph.conflictBehavior=replace SdkVersion : graph-android-v1.7.0 E/DefaultHttpProvider[sendRequestInternal] - 333: Authorization : bearer EwBYA8l6BAAURSN/FHlDW5xN74t[...] {"item":{}} 400 : Bad Request