In the SharePoint classic search center I search for one specific item that I know exists. Sample query


I get exactly one result back. Cool. This is what I want. There is only one item in the tenant using this content type. The result is expected.

Now I want to get this result via the SharePoint REST API. I call:


NO results are returned. How is this possible?

I tried the REST call directly in the browser as well as with the Search Query Tool (using the same tenant admin account for all tests).

My assumption until now was: if I can find it in the SharePoint search center I can get it via REST (and vice versa). This assumption doesn't seem to hold in the cloud.

What's going on here?


As a side node: crawled properties are also not created for the fields of the content type. They should be created since all fields of my item contain values. I heard rumors about a Microsoft update to search went wrong and there are search problems worldwide. But I couldn't find any sources for this.

Edit 2

This is getting weird.

I get no results via REST using the SharePoint root URL. But I get my result when I use a site URL.

So, no result here:


But one result here:


I think I'm going to open a support case. This looks like a bug.

  • You need to encode 'ContentType:Masterdata'. Can you try https://mytenant.sharepoint.com/_api/search/query?querytext=%27ContentType:Masterdata%27? Jun 20, 2018 at 10:14
  • @AtishDipongkor I tried this as well - no difference here. It works with and without encoding. I checked this with other content where both variants return results. Jun 20, 2018 at 10:27
  • You say you tried the REST call with the browser and the Search Query Tool. Did it work with these or did it fail too?
    – wjervis
    Jun 20, 2018 at 12:05
  • Did you try the URL https://mytenant.sharepoint.com/search/_api/search/query?querytext='ContentType:Masterdata' to see if you have site collection specific rules or logic that is not in your tenant root? Jun 20, 2018 at 17:09
  • @wjervis First I tried the Search Query Tool - 0 results. I got suspicious, copied the REST URL directly to the browser - 0 results. All using the same user account. Jun 20, 2018 at 20:18

3 Answers 3


In my experience, this works as expected. Are both of your tests from a browser currently logged into the SharePoint site?

Here's the URL (returns XML):


Here's the AJAX equivalent (requesting JSON format):

    "url": "http://yourServerAndSite/_api/search/query?querytext='ContentType:contract'",
    "method": "GET",
    "headers": {
        "accept": "application/json; odata=verbose"
    "success" : successfunction,
    "error" : errorfunction
  • Unfortunately it does not :( And I am using the same browser. I open the search center, search, find my result. In the same browser, same user, nearly same moment, in a new tab, I paste the REST URL, correct XML is returned with result count = 0. This is not the first time I am using the SP REST API, it always worked. Now it doesn't. But currently Microsoft is having problems with search on many tenants - so let's hope it's temporary... Jun 20, 2018 at 20:15

Having encountered a similar issue, where the API would return an empty array, even though the query was valid, the cause was due to the number of items in the SharePoint library exceeding the 5,000 default threshold, which cannot be changed for Online environments.

Changing the query so that the API doesn't have to scan the the large view returned results.

That, or remove some items from the Library. Both work.


We have found the solution to our problem. Adding this property to the search query shows all results:


The problems seems to be with search requests "crossing" the classic/modern border. So if you use the search API endpoint on a classic site results from modern sites are missing, unless you add above parameter. At least so it seems.

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.