API

API methods

For a head start you can also download a POSTMAN collection of the endpoints (what is POSTMAN?).

Add a page to the index (or re-index a page)

The unique identifier for an indexed page is its URL. If you have a page with a given URL already, it will be updated.

Where {URL} is the absolute URL you want to index.

You can also send the indexable data directly as a JSON.

The body of the POST request must contain a JSON object of the following format:

The fields dataPoints, filters, language, and boost are optional.

NOTE: Filters have to be defined in the Control Panel and referenced with the generated Filter-ID.

You can also index up to 100 JSON entries at once.

The body of the POST request must contain a JSON array consisting of JSON objects in the following format:

Remove a page from the index

Where {URL} is the absolute URL you want to index.

Remove multiple pages from the index

Where {URL_PATTERN} is a regular expression. All URLs matching the expression will be removed from the index.

Search

Where

  • {SITE_ID} is your siteId.
  • {QUERY} is your search query.
  • {FILTER_OPTIONS} (optional) if set to true the API will return possible filters found in the result set.
  • {FILTERS} (optional) is a JSON array of filters. Filters are structured the same way for querying as when indexing. For example, [{"key": "value"},{"votes": {"min":2,"max":256}},{"tags": ["abc","def"]}].
  • {SORT} (optional) The name of the data point by which you want to sort.
  • {ORDER} (optional) The sorting order, either ASC for ascending or DESC for descending.
  • {INCLUDE} (optional) if set to true, the results will contain the content snippet. By default it is false.
  • {HIGHLIGHT} (optional) if set to true, the query terms will be marked up with a . By default the parameter is false.
  • {CONTENT_GROUPS} (optional) if you only want to search within certain content groups, you can specify them in a JSON array here. For example, ["group1","group2"].
  • {OFFSET} (optional) is the number of results to skip from the beginning.
  • {LIMIT} (optional) is the number of results to return within range [1,100].
  • {LOG} (optional, true|false) whether to log the query or not (default is true).

The search response will have the following structure:

Where

  • suggests is a mapping of content groups to array retrieved search results. All uncategorized results are categorized as _.
  • query is the search query.
  • totalResults is the number of all available search results.
  • totalResultsPerContentGroup is a mapping of all available search results per content group.
  • sortingOptions is an array of all available sorting options.
  • sorting is the active/selected sorting option.
  • filterOptions is an array of available filtering options.
  • activeFilterOptions is an array of applied filter options.

Search Suggestion

Where

  • {SITE_ID} is your siteId.
  • {QUERY} is your search query.
  • {LIMIT} (optional) is the number of results to return within range [1,20].

Log Query

Searches are logged automatically (if {LOG} is true). If you do not use the Site Search 360 Javascript but only the API, you can use this endpoint to also log abandoned search suggestions and selected suggestions.

Where you have to send the following parameters in the POST body:

  • query: The query to log.
  • action: The action, either "select" (search suggestion was selected) or "abandon" (search suggestions started but query not executed).
  • timeToAction (optional): The number of milliseconds before the user abandoned or selected the query.
  • site: Your site id.
  • apiKey: Your API key.

Index Status

This endpoint returns a json with the number of indexed pages.

To check which pages have been indexed, you can use an even more elaborate request.

Where you can use the following query parameters to filter the results:

  • {URL} (optional): The string that should be part of the URL.
  • {CONTENT_TYPE} (optional): The content type you want to filter by, e.g. "HTML" or "PDF".
  • {STATUS} (optional): The index status you want to filter by, e.g. 200 for successfully indexed.
  • {OFFSET} (optional) is the number of results to skip from the beginning.
  • {LIMIT} (optional) is the number of results to return within range [1,100].

This endpoint allows you access to what you see in the index status table under Index Control.

Get frequent queries within a certain time frame

Where

  • {START_TIMESTAMP} is the UNIX timestamp of the begin of the period.
  • {END_TIMESTAMP} is the UNIX timestamp of the end of the period.

Get queries within a certain time frame

Where

  • {START_TIMESTAMP} is the UNIX timestamp of the begin of the period.
  • {END_TIMESTAMP} is the UNIX timestamp of the end of the period.