Discovery APIs Archives - SearchStax Docs Documentation Thu, 26 Oct 2023 16:53:30 +0000 en-US hourly 1 https://wordpress.org/?v=6.4.2 https://www.searchstax.com/docs/wp-content/uploads/2023/10/cropped-favicon-32x32.png Discovery APIs Archives - SearchStax Docs 32 32 Overview https://www.searchstax.com/docs/searchstudio/discovery-apis-overview/ Mon, 22 May 2023 22:36:57 +0000 https://www.searchstax.com/docs/?post_type=searchstudio&p=15518 Discovery API Overview The Discovery API tab includes details for the Popular Searches API and the Related Searches API. Questions? Do not hesitate to contact the SearchStax Support Desk.

The post Overview appeared first on SearchStax Docs.

]]>
Discovery API Overview

The Discovery API tab includes details for the Popular Searches API and the Related Searches API.

Questions?

Do not hesitate to contact the SearchStax Support Desk.

The post Overview appeared first on SearchStax Docs.

]]>
Popular Searches API https://www.searchstax.com/docs/searchstudio/searchstax-studio-popular-searches-api/ Thu, 01 Sep 2022 17:11:44 +0000 https://www.searchstax.com/docs/?post_type=searchstudio&p=12521 Popular Searches API SearchStax Studio’s Popular Searches API retrieves the most Popular Searches recorded by the Studio App during the previous 30 days. This page describes how to retrieve a… Continue reading Popular Searches API

The post Popular Searches API appeared first on SearchStax Docs.

]]>
Popular Searches API

SearchStax Studio’s Popular Searches API retrieves the most Popular Searches recorded by the Studio App during the previous 30 days.

This page describes how to retrieve a Json document of popular-search strings for display on your search page.

The API can be accessed through any tool that assembles HTTP requests and dispatch them to a server. Among these would be the Python coreapi package, the Postman tool, and cURL. For Windows, use PowerShell 7.

Symbols enclosed in carets (< and >) such as <username> are metavariables. Substitute your local values when you encounter them in the examples.

Popular Search

This method returns a list of Popular Searches from a Search App. The pool of searches covers the most recent 30 days of search history.

GET <popular-searches-URL>?language=<code>&page=<n>&num_results=<n>

where <popular-searches-URL> is an endpoint from the Discovery API Tab of the App Settings screen. Language is an optional two-letter language code. Page is an optional page within the paginated result set. Num_results is an optional limit on the number of searches desired (1 through 20).

This method uses Discovery API Key authorization. The Discovery API key is displayed on the Discovery API Tab. It must be passed in the header of the request.

When invoked from Linux (Bash shell):

curl 'https://app.searchstax.com/api/v1/nn/popular-search/?language=en&num_results=10' -H 'Authorization: f17e2131927b055383669327b1dc95338a7bdd7d' 

The response is a JSON document containing a list of popular searches.

{
  "responseHeader": {
    "zkConnected": true,
    "status": 0,
    "QTime": 1
  },
  "response": {
    "numFound": 4,
    "start": 0,
    "numFoundExact": true,
    "docs": [
      {
        "query": "drupal integration",
        "count": 12
      },
      {
        "query": "solr",
        "count": 3
      },
      {
        "query": "sitecore",
        "count": 2
      },
      {
        "query": "test",
        "count": 2
      }
    ]
  }
}

The fields of each popular search have the following meanings:

  • query: The text of a popular search.
  • count: How many time the Search App has encountered this search.

The other fields are Solr internal values.

Questions?

Do not hesitate to contact the SearchStax Support Desk.

The post Popular Searches API appeared first on SearchStax Docs.

]]>
Related Searches API https://www.searchstax.com/docs/searchstudio/related-searches-api/ Tue, 21 Dec 2021 20:32:14 +0000 https://www.searchstax.com/docs/?post_type=searchstudio&p=10430 Related Searches API SearchStax provides an API that retrieves the Related Searches defined for a specific search phrase in the SearchStax Studio App. Related Searches allows users to manually define… Continue reading Related Searches API

The post Related Searches API appeared first on SearchStax Docs.

]]>
Related Searches API

SearchStax provides an API that retrieves the Related Searches defined for a specific search phrase in the SearchStax Studio App.

Related Searches allows users to manually define Search terms that are related, and augments them from search terms learned using Artificial Intelligence using Analytics data. For the AI augmented related searches, Analytics should be connected with your Search page and there should be enough searches with clicks available.

This page describes how to retrieve a Json document of related-search strings for display on your search page.

The API can be accessed through any tool that assembles HTTP requests and dispatch them to a server. Among these would be the Python coreapi package, the Postman tool, and cURL. For Windows, use PowerShell 7.

Symbols enclosed in carets (< and >) such as <username> are metavariables. Substitute your local values when you encounter them in the examples.

Related Search

This method returns a list of Related Searches from a SearchStudio App.

GET <related-searches-URL>?search=<search-phrase>

where <related-searches-URL> is an endpoint from the Discovery API Tab of the App Settings screen, and <search-phrase> is the base query that has related searches defined on the Related Searches screen.

This method uses SearchAPIKey authorization. The Search API key is displayed on the Discovery API Tab. It must be passed in the header of the request.

When invoked from Linux (Bash script):

URL="https://app.searchstax.com/api/v1/nn/related-search/"
APIKEY="456cwe54sasb8e5lu5y6k48j55u95338slas"
KEYWORD="sitecore"

SEARCHES=$(curl -H "Authorization: $APIKEY" "$URL?search=$KEYWORD") 

When invoked from Windows Powershell:

# Removes TLS obstacles from connection. Otherwise connections fail. 
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12

$URL = "https://app.searchstax.com/api/v1/nn/related-search/"
$APIKEY = "81c09977fedb7e89310c87df81d7bc787301155e"
$KEYWORD = "Sitecore"

# Set up HTTP header for authorization token
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", $APIKEY)

$RESPONSE = Invoke-RestMethod -Method Get -ContentType 'application/json' -Headers $headers `
              -uri $($URL+"?search=$KEYWORD") 
$RESPONSE = $RESPONSE | ConvertTo-Json -Depth 3

Write-Host $RESPONSE

The response is a JSON document containing a list of related searches.

{
  "responseHeader": {
    "zkConnected": true,
    "status": 0,
    "QTime": 0
  },
  "response": {
    "numFound": 5,
    "start": 0,
    "numFoundExact": true,
    "docs": [
      {
        "search_term": "sitecore",
        "related_search": "sitecore 10",
        "related_score": 1
      },
      {
        "search_term": "sitecore",
        "related_search": "sitecore plugin",
        "related_score": 1
      },
      {
        "search_term": "sitecore",
        "related_search": "sitecore replace azure",
        "related_score": 1
      },
      {
        "search_term": "sitecore",
        "related_search": "site search for sitecore",
        "related_score": 1
      },
      {
        "search_term": "sitecore",
        "related_search": "managed solr for sitecore",
        "related_score": 1
      }
    ]
  }
}

The fields of each related search have the following meanings:

  • search_term: This is the search string that keys to the Related Searches.
  • related_search: Each entry contains the string of a single Related Search.
  • related_score: A measure of similarity to the search_term. The range of values is 0 to 1. Higher values are more similar.

Questions?

Do not hesitate to contact the SearchStax Support Desk.

The post Related Searches API appeared first on SearchStax Docs.

]]>