1

Wondering if you could help me please, I am currently calling the SharePoint rest search api with a number of parameters as below:

GET: https://tenant.sharepoint.com/sites/sitecol/_api/search/query?
querytext='path:https://tenant.sharepoint.com/sites/sitecol ContentTypeId:0x0101008CA34DF8F4904B3EB1EB49AC10614C68*'
&trimduplicates=false
&startrow=0
&rowlimit=1
&selectproperties='Write,Path,LastModifiedTime'&refiners='LastModifiedTime(discretize=manual/2017-12-01/2018-01-01/2018-03-01/2018-03-01/2018-04-01/2018-05-01/2018-06-01/2018-07-01/2018-08-01/2018-09-01/2018-10-01/2018-11-01/2018-12-01/2019-01-01/2019-03-01/2019-03-01/2019-04-01/2019-05-01/2019-06-01/2019-07-01,sort=name/descending,filter=99/1/*)'
&ClientType='ContentSearchRegular'

I am using the header Accept: application/json;odata=nometadata

However when running this in Postman or SharePoint online I get the following returned:

{ "odata.error": { "code": "-1, Microsoft.Office.Server.Search.REST.SearchServiceException", "message": { "lang": "en-US", "value": "An unknown error occurred." } } }

The only method I appear to have found to fix this is to reduce the number of thresholds in the refiner parameter however I am unable to find any documentation detailing the maximum number of thresholds that can be used.

I appreciate any help that anyone can give on this matter.

1 Answer 1

1

An explanation can be found at :

https://blog.beecomedigital.com/2015/12/22/performing-a-search-request-with-sharepoint-rest-api-throws-a-microsoft-sharepoint-client-unknownerror/

You should specify Odata version as 3.0 and not 4.0 because the search API does not work with 4.0.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.