Search APIs

Integrate Search APIs to execute natural language queries, retrieve insights, and embed search functionality into your applications seamlessly.

WebSockets

In WebSockets, a connection is established with the SQE service using an auth token. Each communication message is associated with a corrId (correlation ID) to map a response with its corresponding request.

Initialization

Endpoint: ws://qa.minion.tellius.com:31144/sqeWebSocket

As per the following snippet, the connection needs to be validated with an initial request consisting of a user token.

{
    "token": "<your_authorization_token_here>"
}

Response

{
"userId": "abcde34",
"status": "initialized",
"rId": "5da08f43-0ad5-4a13-932e-7e7f8f64d390"
}

Heartbeat

The WebSocket can always be tested for the established connection using a heartbeat call, which also ensures that the socket connection is not timeout under idle.

To test a connection

Request - {"requestType": "ping"}

Response - {"status":"CONNECTED","responseType":"pong"}

Search queries APIs

The entire Search function works on WebSocket communication. For each query function, users need to generate corrId. Every Response will be matched with its corresponding Request using corrId. The search box will be available in the UI, and the user can hit the following APIs to view history and suggestions, validate, and execute queries.

View history

To view the history of previously typed queries, use the following request:

Request

Response

If there is no history to be displayed, then an empty history object will be returned.

View suggestions

To display the list of suggestions

Request

Response

Validate a query

Request

A query will be validated if the attribute enterKeyPress is set to false.

Response

  • The aggregatedField in the response refers to a measure used in the query. For example, if you use two measures "Profit" and "Sales", then there will be two components in the aggregatedField array.

  • When you click on any token that is used in the query, a list of suggestions will be displayed. For example, for the tokenString (token) Profit, avg Profit, sum Profit, min Proft, max Profit, total Profit, and maxshare Profit are displayed as suggestions.

  • Towards the end, the original query typed by the user will be displayed under originalattribute. Tellius corrects any typos and errors (if present) in the query, and the rectified query will be displayed as a value for fixedQuery attribute.

Failure

If a query cannot be validated, then the following response will be sent:

Execute a query

A query will be executed only if performQuery, enterKeyPress, and createViz is set to true.

Request

Response

Was this helpful?