The Embedded Search API enables searching directly from an external application or web page to pull data from ThoughtSpot. This feature was introduced in ThoughtSpot 5.0. When using it, you can access data stored in ThoughtSpot directly. You do not have to save a search result to a pinboard and then reference it using the visualization’s URL.
This embedded search is useful when you want to allow an application to pull data directly from ThoughtSpot in an ad hoc fashion.
To have the Embedded Search API functionality turned on, contact ThoughtSpot Support.
Data retrieved using the Embedded Search API is returned as JSON (JavaScript Object Notation). You must parse the JSON to get the data values you need, generally using JavaScript in the receiving application.
Use this procedure to construct the call to the Embedded Search API:
-
Enable the JavaScript API (JS API) on the receiving page of the target application.
-
Authenticate to ThoughtSpot on the receiving page of the target application.
-
Embed the ThoughtSpot application in your own web page or application.
-
To subscribe to results for all the searches the user does in the embedded ThoughtSpot application, use the API JavaScript function subscribeToData( ). This will allow your page to listen for data coming from ThoughtSpot.
Now when a user searches, the <iframe> sends data to the subscription. The parent web page or application receives the data as JSON, and can do whatever you want with it.
-
You can set up your web page or application to display or otherwise act on the data it receives from the subscription.
-
To test it out, do a search in the embedded ThoughtSpot application to retrieve the data. Your application should act on the data in the way you set it up to do so.