Following "https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_createuploadsession?view=odsp-graph-online" to call OneDrive graph api.
Account "A" was created before 2019/11,
Account "B" was created recently.
Request1:
{
"item": {
"@microsoft.graph.conflictBehavior": "rename",
"description": "",
"fileSystemInfo": {"@odata.type": "microsoft.graph.fileSystemInfo"},
"name": "ttttt.jpg"
}
}
If using account "A", the response is as follows:
{
"error": {
"code": "invalidRequest",
"message": "Invalid request",
"innerError": {
"date": "2024-09-30T12:52:59",
"request-id": "9c768b04-0dfd-41d1-a3f0-69c223536fa6",
"client-request-id": "9c768b04-0dfd-41d1-a3f0-69c223536fa6"
}
}
}
If using account "B", the response is as follows:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.uploadSession",
"expirationDateTime": "2024-10-05T13:17:50.988Z",
"nextExpectedRanges": ["0-"],
"uploadUrl": "https://api.onedrive.com/rup/1fe3b5cce115f141/eyJSZXNvdXJjZUlEIjoiMUZFM0......"
}
Now just remove "description" from the request.
Request2:
{
"item": {
"@microsoft.graph.conflictBehavior": "rename",
"fileSystemInfo": {"@odata.type": "microsoft.graph.fileSystemInfo"},
"name": "ttttt.jpg"
}
}
If using account "A", the response is as follows:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.uploadSession",
"expirationDateTime": "2024-10-05T13:17:50.988Z",
"nextExpectedRanges": ["0-"],
"uploadUrl": "https://api.onedrive.com/rup/1fe3b5cce115f141/eyJSZXNvdXJjZUlEIjoiMUZFM0......"
}
If using account "B", the response is as follows:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.uploadSession",
"expirationDateTime": "2024-10-05T13:17:50.988Z",
"nextExpectedRanges": ["0-"],
"uploadUrl": "https://api.onedrive.com/rup/1fe3b5cce115f141/eyJSZXNvdXJjZUlEIjoiMUZFM0......"
}
Why does the "description" in the request cause the request to fail for account "A" but work for account "B".