The 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
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:
Parameter | Action |
---|---|
enabled | Set the visibility of the section. Set to true to display the section, or false to hide it. |
title | Customize the title of the section. |
pageSize | Define the number of items to be displayed on a page. |
iconUrl | Provide a URL to the icon you want to display for the section. |
datePrefix | Set the date for the section. You can set any of the following:
|
orderId | Add a value between 1 and the number of items in the internal section. |
sortingOptions | Define the sorting options for the section. You can provide one of the values to be displayed in ascending or descending order:
|
Example request
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.
Update the integration section
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:
Parameter | Action |
---|---|
enabled | Set the visibility of the section. Set to true to display the section, or false to hide it. |
title | Customize the title of the section. |
pageSize | Define the number of items to be displayed on a page. |
iconUrl | Provide a URL to the icon you want to display for the section. |
orderId | Add a value between 1 and the number of items in the integration section. |
datePrefix | Set the date for the section. You can set any of the following:
|
customData | Add the IDs required for further customization of Microsoft 365 and ServiceNow integrations. Learn more about customizing Microsoft 365 Search and ServiceNow Search. |
Example request
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.