JSON endpoint
Introduction
search.json
provides a JSON style API to the Funnelback Modern user interface. It allows developers to integrate Funnelback results into their applications by making HTTP GET calls to search.json
and wrapping the resulting JSON response.
Getting JSON Results from search.json
The following sections give details on how to get results from search.json
.
Query string parameters
search.json
will support the same parameters accepted by the HTML Modern search interface (search), as well as query string parameters accepted directly by the PADRE query processor. Please see the following documents for a list of these parameters:
At a minimum you will need:
-
query
: Query terms -
collection
: The name of the collection to query
Construct a query URL to the live Funnelback search service
If the search service resides at http://company.com/s/search.json
and the query parameters passed into the wrapper script by the user were
-
query
= leave form -
collection
= intranet
then the search URL will be http://company.com/s/search.json?query=leave+form&collection=intranet
Fetch the JSON results
Fetching the JSON results is as simple as making an HTTP GET request at the URL constructed in the step above. How to do this depends on which language your wrapper script is in. In pseudocode, this could be done as:
query = "http://company.com/s/search.json?query=leave+form&collection=intranet" json = http_get(query)
JSONP callback support
search.json
supports JSONP-style callbacks using a callback
parameter. For example if your callback function is named processResults
, you could use the following URL: http://company.com/s/search.json?query=leave+form&collection=intranet&callback=processResults
.
Displaying the Results
Once you have the JSON results you can perform whatever processing you wish on them, like displaying the results in a web page, or un-marshall them into Javascript objects.
The process will be nearly identical as processing the results from search.xml
, so please consult the search.xml page for more details.