Graph API for SharePoint throws "UnknownError" with HTTP 404 when filters exceeds some limit

Kiran Unnikrishnan K 1 Reputation point
2021-04-12T13:08:49.803+00:00

Team,

I'm using GraphAPI to querying the SharePoint list and all is working perfectly until the users select a lot of filter criterias, maybe over 20 filters. When they select too many filters (which as per our business logic is required), the API responds with HTTP 404 and with below response:

{
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"date": "2021-04-12T13:01:26",
"request-id": "7bc60ec8-5939-4b69-a72e-0223d9fa2455",
"client-request-id": "7bc60ec8-5939-4b69-a72e-0223d9fa2455"
}
}

PFB the sample REST API query:

https://graph.microsoft.com/v1.0/sites/xxx.sharepoint.com,xxxxxxx-ee65-47fc-9789-05503befc564,xxxxxxx-add7-41d2-baf0-8f06dcab0572/lists/xxxxxxxx-3BFC-4151-A319-C477C5FEEC6C/items?$filter=(fields/xxx_x0020_Incident eq 'Yes' and (fields/AccountID eq '33657' or fields/AccountID eq '23188' or fields/AccountID eq '23918' or fields/AccountID eq '23253' or fields/AccountID eq '23307' or fields/AccountID eq '24072' or fields/AccountID eq '33300' or fields/AccountID eq '23680' or fields/AccountID eq '23321' or fields/AccountID eq '23422' or fields/AccountID eq '32376' or fields/AccountID eq '23763' or fields/AccountID eq '33582' or fields/AccountID eq '34475' or fields/AccountID eq '24080' or fields/AccountID eq '23651' or fields/AccountID eq '23486' or fields/AccountID eq '24343' or fields/AccountID eq '23597' or fields/AccountID eq '23211' or fields/AccountID eq '35437' or fields/AccountID eq '23612' or fields/AccountID eq '24108' or fields/AccountID eq '23296' or fields/AccountID eq '23377' or fields/AccountID eq '23924' or fields/AccountID eq '32430' or fields/AccountID eq '23880' or fields/AccountID eq '24363' or fields/AccountID eq '24185' or fields/AccountID eq '23872' or fields/AccountID eq '23940' or fields/AccountID eq '23659' or fields/AccountID eq '24404' or fields/AccountID eq '23219' or fields/AccountID eq '24140' or fields/AccountID eq '24386' or fields/AccountID eq '24292' or fields/AccountID eq '23994' or fields/AccountID eq '24117' or fields/AccountID eq '24200' or fields/AccountID eq '23519' or fields/AccountID eq '23287' or fields/AccountID eq '23849' or fields/AccountID eq '24493' or fields/AccountID eq '23938' or fields/AccountID eq '23895' or fields/AccountID eq '23325' or fields/AccountID eq '23540' or fields/AccountID eq '24241' or fields/AccountID eq '23525' or fields/AccountID eq '32949' or fields/AccountID eq '23997' or fields/AccountID eq '23353' or fields/AccountID eq '24389' or fields/AccountID eq '24017' or fields/AccountID eq '23750' or fields/AccountID eq '23990' or fields/AccountID eq '23273' or fields/AccountID eq '23411' or fields/AccountID eq '23965' or fields/AccountID eq '23245' or fields/AccountID eq '23295' or fields/AccountID eq '24154' or fields/AccountID eq '35456' or fields/AccountID eq '24453' or fields/AccountID eq '24239' or fields/AccountID eq '35125' or fields/AccountID eq '23414' or fields/AccountID eq '24009' or fields/AccountID eq '23919' or fields/AccountID eq '24157' or fields/AccountID eq '24407' or fields/AccountID eq '23362' or fields/AccountID eq '24290' or fields/AccountID eq '23864') and (fields/CountryID eq '3452' or fields/CountryID eq '4479')) & $expand=fields($select=Tower,Country,id,incidentID,Incident_x0020_Status,Account,AccountID, Incident_x0020_Occurrence_x0020_,Modified,Received_x0020_Date,City_x0020__x002f__x0020_Site,CitySiteID,Incident_x0020_Discovery,CountryID,Lead_x0020_Analyst_x0020_Email_x,Lead_x0020_Investigator_x0020_Em,Lead_x0020_Analyst_x0020_Name,Lead_x0020_Investigator_x0020_Na) & $top=10 & $orderBy=fields/Modified desc

Works perfectly if I reduce the number of AccountID filter. I'm pretty new to GraphAPI and not sure this is a problem with the query of any limitations on the SharePoint side.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,250 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,810 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MichaelHan-MSFT 18,036 Reputation points
    2021-04-13T09:12:45.24+00:00

    Hi @Kiran Unnikrishnan K ,

    I got the same result when there are two many filters in the API endpoint. I think this related to the limitaion on the number of query parameters.

    You'd better reduce the number of query parameters in your query to make it work.


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.