Get Trending Searches

Follow this tutorial to get the list of the most popular words and phrases that the users search for.

Prerequisites

Before starting this tutorial, you must have:
  • Access to the Search Intelligence service API consoleInformation published on SAP site.

  • Access to the Search Intelligence service API consoleInformation published on SAP site.

  • Access to the Search Intelligence service API console: https://{tenant}.iss.commerce.eu.context.cloud.sap/search-intelligence/ where {tenant} is a placeholder for your tenant name.

  • Access to the Search Intelligence service API console: https://{tenant}.iss.commerce.us.context.cloud.sap/search-intelligence/ where {tenant} is a placeholder for your tenant name.

  • Access to the Trending Search Terms user interface in Intelligent Selling Services.

  • The tracking of KeywordSearch events properly configured.

  • The Trending Search Terms feature enabled. For information on how to enable this feature, refer to the Trending Search Terms user interface.

Procedure

To retrieve the most popular search terms, run the following command:
curl -X 'GET' \
  'https://{tenant}-{site}.api.eu.context.cloud.sap/search-intelligence/v1/sites/{site}/trendingSearches' \
  -H 'accept: application/json'
curl -X 'GET' \
  'https://{tenant}-{site}.api.us.context.cloud.sap/search-intelligence/v1/sites/{site}/trendingSearches' \
  -H 'accept: application/json'
curl -X 'GET' \
  'https://{tenant}.iss.commerce.eu.context.cloud.sap/search-intelligence/v1/sites/{site}/trendingSearches' \
  -H 'accept: application/json'
curl -X 'GET' \
  'https://{tenant}.iss.commerce.us.context.cloud.sap/search-intelligence/v1/sites/{site}/trendingSearches' \
  -H 'accept: application/json'

URI Parameters:

  • {tenant}: Provide your tenant name.

  • {site}: Provide your site identifier.

The response returns a JSON document containing up to 10 most popular search terms. A sample response is shown below.
{
  "updatedAt": "2024-04-11T08:58:05.747359Z",
  "searchPhrases": [
    {
      "searchPhrase": "book",
      "count": 45
    },
    {
      "searchPhrase": "beauty products",
      "count": 31
    },
    {
      "searchPhrase": "office supplies",
      "count": 22
    }
  ]
}

Response details:

  • searchPhrases: Contains a list of trending search terms with the most popular ones at the top of the list.

    Field

    Type

    Example

    Description

    searchPhrase

    String

    office supplies

    The search phrase, always in lower case.

    count

    Number

    22

    The number of users who searched for the phrase.

  • updatedAt: The timestamp in ISO8601 format, indicating when the list was last updated.