Customize the Sections of Search Settings Using the Search Settings API

Learn how to customize search settings based on your organization's needs.

Employee App
Staffbase Intranet
beta

The redesigned search results page offers greater flexibility, allowing you to tailor the search experience to your business needs.

This article explains how to use the Search Settings API to customize search results items in:

  • Internal sections
  • Integration sections
Items within the internal and integration sections can be renamed within their respective sections. Changing the position of the internal and integration sections is not possible.

Prerequisites:

  • You have created an API token with an administrative access level via the Staffbase Studio.
  • You have the ID of the section you want to update.
    To get the ID of the section, make a GET request to /search/settings. In the response, you will find the IDs of all sections.

Update the internal section You can customize the title, visibility, placement order, and other settings of the internal section item to tailor it to your users’ needs.

  • Make a PUT request to /search/settings/internal-sections/{sectionId} and replace {sectionId} with the ID of the section you want to update. In the request body schema, set the following parameters with respective values:
ParameterAction
enabledSet the visibility of the section. Set to true to display the section, or false to hide it.
titleCustomize the title of the section.
pageSizeDefine the number of items to be displayed on a page.
iconUrlProvide a URL to the icon you want to display for the section.
datePrefixSet the date for the section. You can set any of the following:
  • created
  • updated
  • published
  • uploaded
The search results from the section will be displayed based on the value you define. This is not available for People.
orderIdAdd a value between 1 and the number of items in the internal section.
sortingOptionsDefine the sorting options for the section. You can provide one of the values to be displayed in ascending or descending order:
  • relevance
  • recent
  • creation
  • alphabetical
  • published
Terminal window
curl --location --request PUT 'https://exampleapp.staffbase.com/api/search/settings/internal-sections/news' \
--header 'Authorization: Basic {Token}'
--header 'Content-Type: application/json' \
--data '{
"title": {
"de_DE": "Nachrichten",
"en_US": "News"
},
"enabled": true,
"displayType": "standard",
"datePrefix": "updated",
"iconUrl": "https://some-url.here/icons/news.svg",
"pageSize": 10,
"orderId": 1,
"sortingOptions": [
{
"key": "relevance",
"asc": false,
"title": {
"de_DE": "Relevanz",
"en_US": "Relevance"
}
},
{
"key": "recent",
"asc": true,
"title": {
"de_DE": "Neueste zuerst",
"en_US": "Most recent"
}
}
]
}'

You get a 200 OK response that the search settings are updated. For request and response samples, see the Search Settings API.

You can customize the integration section item’s section title, localization string, visibility for users, placement order, and other settings to suit your organizational preferences.

  • Make a PUT request to /search/settings/integration-sections/{sectionId} and replace {sectionId} with the ID of the section you want to update. In the request body schema, set the following parameters with the respective values:
ParameterAction
enabledSet the visibility of the section. Set to true to display the section, or false to hide it.
titleCustomize the title of the section.
pageSizeDefine the number of items to be displayed on a page.
iconUrlProvide a URL to the icon you want to display for the section.
orderIdAdd a value between 1 and the number of items in the integration section.
datePrefixSet the date for the section. You can set any of the following:
  • created
  • updated
  • published
  • uploaded
The search results from the section will be displayed based on the value you define. This is not available for People.
customDataAdd the IDs required for further customization of Microsoft 365 and ServiceNow integrations. Learn more about customizing Microsoft 365 Search and ServiceNow Search.
Terminal window
curl --location --request PUT 'https://exampleapp.staffbase.com/api/search/settings/integration-sections/m365' \
--header 'Authorization: Basic {Token}'
--header 'Content-Type: application/json' \
--data '{
"title": {
"de_DE": "Microsoft 365",
"en_US": "Microsoft 365"
},
"enabled": true,
"displayType": "standard",
"datePrefix": "updated",
"integration": "m365",
"pageSize": 10,
"orderId": 1,
"customData": {
"siteIds": "55981a-91aa-4d9f-ad6f-fecdab410b96,55981a-91aa-4d9f-ad6f-fecdab410b97,55981a-91aa-4d9f-ad6f-fecdab410b55"
}
}'

You get a 200 OK response that the settings are updated. For request and response samples, see the Search Settings API.