Introduction
SearchAssist exposes REST APIs to interact with and access various features of a SearchAssist application such as data ingestion, training, full search, live search, etc. These APIs are secure and can be accessed to utilize the full range of SearchAssist’s capabilities. For a complete list of APIs and usage instructions, refer here.
API Setup
For a third-party application to use the SearchAssist APIs, it is necessary to create a set of credentials and configure an app or web client on the SearchAssist application. For client authentication, SearchAssist uses JSON web tokens(JWT) with the algorithm HS256.
Client Configuration on the SearchAssist application
1. Create credentials and assign relevant scopes
On the SearchAssist application, go to the Credentials page under the Manage tab. Add a credential to be used for authorization of the third-party application invoking the APIs. Enter a name for the credential.
Assign appropriate API Scopes to the credentials and click Save. API scopes define the type of operations that the client can perform on the SearchAssist application through the APIs.
The following table describes the API scopes available.
Scope | Description |
Ingest Data | To allow ingestion of structured data using SearchAssist APIs. |
Train | To allow training of the app using the APIs. |
Live Search | To allow live search for content using the APIs. |
Full Search | To allow full search for content using the APIs. |
Auto Suggestions | To allow auto suggestions feature using the APIs. |
Advanced Search | To allow advanced search using the APIs. |
Fields | To allow managing index fields using the APIs. |
Content | To allow managing content using the APIs. |
App Settings | To allow access to the app settings using the APIs. |
Analytics | To allow access to the analytics generated by the application using the APIs. |
2. Configure Channel
The next step is to configure the client. Go to the Channels page under the Manage tab. Under the App Details, select the credentials created above and click Save. This will generate the Client ID, Client secret, and Search ID required for authentication of the API requests.
Generating JWT tokens
SearchAssist APIs use JWT tokens for authentication. The client application must send a JSON Web Token in the authorization header of the HTTP request to the API. To generate the JWT token, follow the steps listed below.
- Go to the JWT website.
- Select the algorithm as HS256.
- Use the Client ID generated above to create the Payload object in JSON format. A sample JSON object is shown below. Ensure that the key ‘appId’ is spelled exactly as shown below. When the token is generated using any other key like “App ID”, “appid”, or “appID”, SearchAssist will ignore it.
{ “appId”: “<insert your Client Id here>” } |
- Enter your client secret in the placeholder provided under the VERIFY SIGNATURE section.
- Click the SHARE JWT button at the bottom of the page to generate the token.
- Copy the JWT grant token generated under the ENCODED section on the left. This token should be sent in the auth header of the HTTP request.
SearchAssist APIs
Following is the complete list of APIs exposed by SearchAssist. Refer to this link for a detailed description of the APIs and the request and response parameters associated with each of the APIs. You can also try them out here.
API | API Scope | Description |
Live Search | Live Search | To dynamically fetch search results. Note that this API does not return answers. |
Full Search | Full Search | To get search results and answer corresponding to the input query parameters. |
Advanced Search | Advanced Search | To fetch search results and answers corresponding to the input query and the meta filters to be applied to the results. |
Get Auto Suggestions | Auto Suggestions | To get predictions related to the query data in response to an HTTP request. It can be used to provide autocomplete feature for a text-based search functionality. |
Train | Train | To train the SearchAssist application with the ingested data using the default Index and Search settings. |
Ingest Data | Ingest Data | To ingest data into the SearchAssist application. Currently, this API supports only structured data. |
Add Index Fields | Fields | To add one or more Index fields to the SearchAssist application. |
Update Index Fields | Fields | To update one or more existing Index fields in the SearchAssist application. |
Get Index Fields | Fields | To fetch the existing Index fields from the SearchAssist application. |
Delete Index Fields | Fields | To delete one or more existing index fields in the SearchAssist application. |
Update Index Field by ID | Fields | To update a specific Index field in the SearchAssist application. |
Get Index Field By ID | Fields | To get a specific Index field from the SearchAssist application based on the Index field ID. |
Get Source Content | Content | To fetch the details of the source content ingested in the SearchAssist application. |
Delete Source Content | Content | To delete content from the SearchAssist application. |
Get Source Content by Condition | Content | To fetch specific content from the SearchAssist application on the basis of the conditions specified in the request. |
Import Index Pipeline | App Settings | To import an index configurations into the SearchAssist application. |
Export Index Pipeline | App Settings | To export all the index configurations available in the SearchAssist application. |
Get Analytics Data | Analytics | To fetch analytics generated by the SearchAssist application. You can apply filters to fetch specific reports. |
Get User History | History | To fetch the logs corresponding to a user’s interaction with the SearchAssist application. |