Graph API: Upload small item to OneDrive fails with error 504 - azure

I am trying to upload a small item (size less than 4 MB) to OneDrive. It was working perfectly fine till a few days back but now I am consistently seeing 504 error.
I am using Graph APIs and JSON batching to upload to OneDrive. The same code works with other tenants but is failing for this particular tenant for the last 4/5 days.
Please note that the download of items and upload of large items (size greater than 4 MB) works perfectly fine.
Please let me know if anyone has any idea about this issue.
Error response I am getting below:
{"responses": [
{
"id": "1",
"status":504,
"headers" : {
"Content-Type":"application/json"},
"body":"ew0KICAiZXJyb3IiOiB7DQogICAgImNvZGUiOiAiVW5r
bm93bkVycm9yIiwNCiAgICAibWVzc2FnZSI6ICIiLA0KICAgICJp
bm5lckVycm9yIjogew0KICAgICAgImRhdGUiOiAiMjAyMC0xMi0
yOFQxMDo1NDo1NyIsDQogICAgICAicmVxdWVzdC1pZCI6ICJjMmYzYWFmNi1lZj
EyLTRhZTMtOWUwYy0yMTI5ZTJhZTg4ZDEiLA0KICAgICAgImNsa
WVudC1yZXF1ZXN0LWlkIjogImMyZjNhYWY2LWVmMTItNGFlMy0
5ZTBjLTIxMjllMmFlODhkMSINCiAgICB9DQogIH0NCn0="},
{
"id": "2","status":424,
"body":{
"error": {
"code": "FailedDependency",
"message": "Request failed as dependent request failed",
"innerError": {
"date": "2020-12-28T10:54:57",
"request-id": "c2f3aaf6-ef12-4ae3-9e0c-2129e2ae88d1",
"client-request-id": "c2f3aaf6-ef12-4ae3-9e0c-2129e2ae88d1"
}
}
I am sending the request after encoding the body to Base 64 format. The Base 64 text in the above response translates to the following:
{
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"date": "2020-12-28T10:54:57",
"request-id": "c2f3aaf6-ef12-4ae3-9e0c-2129e2ae88d1",
"client-request-id": "c2f3aaf6-ef12-4ae3-9e0c-2129e2ae88d1"
}
}
}

Related

MS Graph API - List Children in DriveItems is failing with 404(itemNotFound)

I'm using the API v1.0/sites/:id/drive/items/:parent/children to fetch the children informations of the drive item. I'm able get the response for some sites but for couple of sites I end up with the error 404(itemNotFound).
I passed siteId in place of :id & parentReferenceId in place of :parent.
{
"error": {
"code": "itemNotFound",
"message": "The resource could not be found.",
"innerError": {
"date": "2022-03-15T05:25:34",
"request-id": "2afc519e-95b0-45b0-bd91-3c716154cdcd",
"client-request-id": "2afc519e-95b0-45b0-bd91-3c716154cdcd"
}
}
}
What is the reason for this behavior?
Try this url pattern to get list of files and sub-folders
https://graph.microsoft.com/v1.0/sites/<SITE_ID>/drives/<DRIVE_ID>/root:<PATH_TO_NESTED_SUB_FOLDERS>:/children
Example:
https://graph.microsoft.com/v1.0/sites/9e9145345-7f9j-4695-8701-bae4c2d8a553/drives/b!HTaRnpV7lUaKdgmdflilU5eQE4tMetVNifXIJN28qvp68vQzkrpfTLPMl6eBQi_4/root:/InnerFolder/InnerFol2:/children

Microsoft Graph API Add "Error while adding group as a member to other group"

I am getting an error when adding a group as a member of other group using the Microsoft Graph API. It was working okay before, but now it's giving me an error.
I am using this:
POST https://graph.microsoft.com/v1.0/groups/{group-id}/members/$ref
Content-type: application/json
body:
{
"#odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/{id}"
}
And I am getting this error:
{
"error": {
"code": "Request_BadRequest",
"message": "An invalid operation was included in the following modified references: 'members'.",
"innerError": {
"date": "2021-09-08T16:09:31",
"request-id": "b1f3a1d9-96ae-4f3e-9ec0-73781bed4379",
"client-request-id": "b1f3a1d9-96ae-4f3e-9ec0-73781bed4379"
}
}
}

$filter Azure Audit logs

I am using the following API
https://learn.microsoft.com/en-us/graph/api/directoryaudit-list?view=graph-rest-1.0&tabs=http
I want to filter resources for only UserManagement category but for some reason the API call I am making gives me error
This is the exact API call
GET https://graph.microsoft.com/v1.0/auditLogs/directoryAudits?$filter=category/any(s:s eq 'UserManagement')
{
"error": {
"code": "BadRequest",
"message": "Invalid filter clause",
"innerError": {
"date": "2021-08-10T06:27:37",
"request-id": "cfd471b2-8b13-4a43-b3de-c6a963425f8c",
"client-request-id": "cfd471b2-8b13-4a43-b3de-c6a963425f8c"
}
}
}
I was able to filter data using startsWith instead of ne
https://graph.microsoft.com/v1.0/auditLogs/signIns?$filter=startsWith(userPrincipalName, 'user.com#EXT##dm4.onmicrosoft.com')
Apparently the lambda operator doesn't work but I can still query like this
https://graph.microsoft.com/v1.0/auditLogs/directoryAudits?$filter=category eq 'UserManagement'

Graph REST API - Cannot access a DriveItem's ListItem

I'm using the rest api to access my drive's items.
I can access the items perfectly fine like this:
https://graph.microsoft.com/v1.0/drives/{{driveid}}/items/{{folderid}}/children
But this is where my problems lie:
This:
https://graph.microsoft.com/v1.0/drives/{{driveid}}/items/{{folderid}}/children?expand=fields
Gives this result:
{
"error": {
"code": "invalidRequest",
"message": "Could not find a property named 'fields' on type 'oneDrive.item'.",
"innerError": {
"date": "2021-09-02T10:50:12",
"request-id": "075bf9b7-c93a-43d2-a1ed-bd4563399f1a",
"client-request-id": "075bf9b7-c93a-43d2-a1ed-bd4563399f1a"
}
}
}
And this:
https://graph.microsoft.com/v1.0/drives/{{driveid}}/items/{{folderid}}/children?expand=listitem
Gives this result:
{
"error": {
"code": "invalidRequest",
"message": "Could not find a property named 'listitem' on type 'oneDrive.item'.",
"innerError": {
"date": "2021-09-02T10:50:30",
"request-id": "2db87d5f-fbe9-42ad-a61e-a377bafafcad",
"client-request-id": "2db87d5f-fbe9-42ad-a61e-a377bafafcad"
}
}
}
I've tried ?$expand=fields and that gives me this message:
"Parsing OData Select and Expand failed: Could not find a property named 'fields' on type 'microsoft.graph.driveItem'."
What am I doing wrong? Because I have another separate SharePoint site and the ?expand=listitem works perfectly.
I've managed to get a decent workaround by using the Graph SDK:
graphClient
.Sites[SiteID]
.Drives[DriveID]
.Items[FolderID]
.Children
.Request()
.Expand(item => item.ListItem)
.GetAsync();

Microsoft Graph(German cloud) - Get root site (sites/root)

When making a call to the Microsoft German Graph /sites/root endpoint, it returns 'Resource Not Found', although that in global Graph the same endpoint works perfectly ok
Here is an example:
https://graph.microsoft.de/v1.0/sites/root
It returns:
{
"error": {
"code": "BadRequest",
"message": "Resource not found for the segment 'sites'.",
"innerError": {
"request-id": "aff4a613-54ed-476d-976f-d4ac7a8c7ee2",
"date": "2018-04-26T07:59:17"
}
}
}
Found an answer, for now, this service is deployed only in the "beta" API
So I used https://graph.microsoft.de/beta/sites/root and it works

Resources