Using SharePoint 2013 Search REST API to execute PostQueries

Because I'm currently writing my first Add-on for ShareCoffee which will provide a fluent and easy way to program against SharePoint's Search Services, I had to dig a little bit deeper into SharePoint Search REST API. Executing Search requests as a GET request is really straight forward and there is nothing special about them. But if you hit the URL length limitation of your browser you should consider executing the search query using SharePoint's PostQuery endpoint. (/_api/search/postQuery).

When doing this POST request it's very important to provide all! properties with correct casing. Internally the request will be serialized into an instance of Microsoft.Office.Server.Search.REST.SearchRequest (see http://msdn.microsoft.com/en-us/library/hh627069(v=office.12).aspx for documentation).

Unfortunately the current implementation isn't able to ignore the casing while transforming the REST request into the CLR object. If you provide a wrong casing to any of the properties you'll be faced with an error instead of receiving all the suggested results from SharePoint's search. In the case that you're not using ShareCoffee and it's upcoming Search add-on for querying the SharePoint Search you should definitively keep this in mind.    

Comments

comments powered by Disqus