SharePoint Search API

SharePoint Enterprise Search capabilities are exposed for use from SharePoint Apps and external Applications through various interfaces. While some of these APIs needs SharePoint context, REST based APIs on the other hand can be accessed directly.

Following are the different API options available.

API name Class library or schema and path
.NET client object model (CSOM) Microsoft.SharePoint.Client.Search.dll
%ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\ISAPI
Silverlight CSOM Microsoft.SharePoint.Client.Search.Silverlight.dll
%ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\TEMPLATE\LAYOUTS\ClientBin
JavaScript CSOM SP.search.js
%ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\TEMPLATE\LAYOUTS
Representational State Transfer (REST) service endpoints http://server/_api/search/query
http://server/_api/search/suggest
Server object model Microsoft.Office.Server.Search.dll
%ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\ISAPI

The drug increases the blood http://deeprootsmag.org/2015/11/19/a-master-in-his-element-on-key-on-time-wed-to-the-truth/ commander levitra circulation in the reproductive organs. At any rate one more analyze exhibits with it likewise enhances sexual intercourse for many postmenopausal girls, viagra cialis online . Some hair loss cures fall into the categories of getting a transplant or using some sort of drug or cialis canada prescription medication as the real treatment could be done to check on the levels of your Vitamin D. Biofeedback Equipment: This device is used by therapists to get an audio and visual feedback of the patients’ response to the viagra pharmacy kind of treatment they are being criticised or laughed upon by their partners.
If .NET client object model (CSOM) or JavaScript CSOM are used on the client, the server would require to have SharePoint Server 2013 Client Components SDK installed. Which can be downloaded at http://www.microsoft.com/en-ca/download/details.aspx?id=35585

API selection matrix

APIMatrix

REST

Search in SharePoint 2013 includes a Search REST service you can use to add search functionality to your client and mobile applications by using any technology that supports REST web requests. You can use the Search REST service to submit Keyword Query Language (KQL) or FAST Query Language (FQL) queries in your apps for SharePoint, remote client applications, mobile applications, and other applications.

The Search REST service supports both HTTP POST and HTTP GET requests.

GET requests

Construct the URI for query GET requests to the Search REST service as follows:

/_api/search/query

For GET requests, you specify the query parameters in the URL. You can construct the GET request URL in two ways:

http://server/_api/search/query?query_parameter=value&query_parameter=value

http://server/_api/search/query(query_parameter=value&query_parameter=<value>)

POST requests

You construct the URI for query POST requests to the Search REST service as follows:

/_api/search/postquery

 

References

http://msdn.microsoft.com/en-us/library/office/jj163876(v=office.15).aspx

http://blogs.msdn.com/b/nadeemis/archive/2012/08/24/sharepoint-2013-search-rest-api.aspx

Query

When you make a call to the Search REST service, you specify query parameters with the request. Search in SharePoint 2013 uses these query parameters to construct the search query. With a GET request, you specify the query parameters in the URL. For POST requests, you pass the query parameters in the body in JavaScript Object Notation (JSON) format.

Sample GET request:

http://server/_api/search/query?querytext=’sharepoint’

Sample POST request:

JSON

{
‘__metadata’ : {‘type’ : ‘Microsoft.Office.Server.Search.REST.SearchRequest’},
‘Querytext’ : ‘sharepoint’
}

 

Suggestions

The Search REST service includes a Suggest endpoint you can use in any technology that supports REST web requests to retrieve query suggestions that the search system generates for a query from client or mobile applications.

The URI for GET requests to the Search REST service’s Suggest endpoint is:

/_api/search/suggest

The query suggestion parameters are specified in the URL. You can construct the request URL in two ways:

http://server/_api/search/suggest?parameter=value&parameter=value

http://server/_api/search/suggest(parameter=value&parameter=value)

Note: The Search REST service doesn’t support anonymous requests to the Suggest endpoint.

Search on SharePoint public sites

Secured

Search and Analytics capability is inbuilt to SharePoint 2013. Analytics in combination with Ranking Models on SharePoint works to automatically process and rank search result sets. Secured SharePoint sites helps to security trim the result sets.

Unsecured

 

SharePoint public sites accessible to all (anonymous) will have some limitations when it comes to Search capability. Limitations include lack of suggest option and result sets will exclude any results which is secured.

Non-SharePoint public sites

SharePoint Search can be extended on a non-SharePoint public facing website through SharePoint Service APIs.  Refer to Section SharePoint Search API for details.

Enable Anonymous Access to Search API

 

SharePoint Search API are hosted a SharePoint sites. Follow the instructions below to set up a SharePoint site to host Search API.

 

  1. Create a publishing site for search access
  2. Configure this site for anonymous access and Basic Authentication: AnonAnon1
  3. Remove restrictions on Client Object accessRemoveRest
  4. Create a new Document Library called “QueryPropertiesTemplate ” at rootweb.
  5. Upload “queryparametertemplate.xml” file to the above Document Library
  6. When Query APIs are called from Wrapper service, pass query param:
    &QueryTemplatePropertiesUrl=’spfile://webroot/queryparametertemplate.xml
  7. In the xml file whitelist search options:QueryProps