Embed objects using REST API

Embed objects using REST API

You can use the REST API to get an object from ThoughtSpot and embed it in a web page, portal, or application. ThoughtSpot provides an embed link for objects, such as Liveboards and visualizations, using which you can construct the URL required to make an API call.

To get the embed link for a Liveboard:

  1. Log in to ThoughtSpot.

  2. Navigate to the Liveboard.

  3. Note the GUID number of the object.

    To embed a Liveboard, click More the more options menu, and select Copy embed link.

    Copy embed link

    To get the embed link for a visualization:

    1. Navigate to the table or chart

    2. Click More the more options menu in the upper right corner of the table or chart.

    3. Click Copy embed link icon.

      Copy link
    Note

    The Copy embed link menu action is available only if Classic Liveboard experience is enabled on your instance.

  4. Note the GUID of the object.

  5. Copy the embed link.

    Paste it somewhere so that you can use it later to construct the URL for the REST API call.

    If you want to embed a Liveboard, copy the identifier that appears after viz/.

    Copy Liveboard link

    For visualizations (table or chart), copy the IDs that appear after viz/.

    Copy visualization link
  6. Construct the URL.

    For a Liveboard, the URL is as follows:

    https://{ThoughtSpot-Host}/callosum/v1/tspublic/v1/pinboarddata?id=<Liveboard_id>

    For a visualization, the URL is as follows:

    https://{ThoughtSpot-Host}/callosum/v1/tspublic/v1/pinboarddata?id=<Liveboard_id>&vizid=%5B<visualization_id>%5D
    Note

    Make sure you add brackets around the vizid parameter. The URL encoding for the opening bracket is %5B and the closing bracket is %5D.

  7. To apply filters to the data, use runtime filters.

    For example, to sort values equal to red in the Color column for a visualization in a Liveboard, you can pass the runtime filter in the URL query parameters as shown here:

    http://{ThoughtSpot-Host}/callosum/v1/tspublic/v1/pinboarddata
    ?id=<Liveboard_id>&vizid=%5B<visualization_id>%5D
    &col1=color&op1=EQ&val1=red
  8. After you construct the URL, send a POST request to get data from ThoughtSpot.

    The API returns the data formatted as JSON.

  9. Retrieve the data from the JSON and embed it in your Web page, Web portal, or application.

For more information, see Runtime filters.

Note

Runtime Filters can also be applied on visualizations or Liveboards embedded in your application. You can specify the runtime filter criteria in the SDK when embedding ThoughtSpot objects. For more information, see Embed a visualization and Embed a Liveboard.