Use the Data REST API to get data

This procedure shows how to use the REST API to get data out of ThoughtSpot, so you can use it in a webpage, portal, or application.

Data retrieved using the Data REST API is returned as JSON (JavaScript Object Notation).

Before you can use the Data REST API, you need to enable the JavaScript API (JS API) and authenticate to ThoughtSpot.

Use this procedure to construct the URL you will use to call the Data REST API:

  1. Sign in to ThoughtSpot from a browser.

  2. Navigate to the Liveboard from which you want to get data. If it doesn’t exist yet, create it now.

  3. Find the ID number of the object you want to get the data from. Select the More menu icon more options menu icon for the object and select Copy embed link.

  4. Copy the ID number from the link shown. Paste it somewhere so that you can use it later to construct the URL to use when calling the REST API.

    If the object is:

    Liveboard

    Copy the identifier that appears after "viz/". Omit the trailing "/".

    The copy link modal
    Visualization

    Copy the entire identifier that appears after "viz/". This is the visualization ID. This includes the Liveboard ID as well.

    Note: A visualization is a table or a chart.

    The copy link modal
  5. Construct the URL as follows: For a Liveboard, the URL takes the form:

    https://<thoughtspot_server>/callosum/v1/tspublic/v1
      /pinboarddata?id=<pinboard_id>

    For a visualization, the URL takes the form:

     https://<thoughtspot_server>/callosum/v1/tspublic/v1
      /pinboarddata?id=<pinboard_id>&vizid=%5B<visualization_id>%5D
  6. If you want to apply any filters to the data that will be returned, apply Runtime filters.

  7. Now your URL is complete, and you can use it to access the data directly through the HTTP POST method. The Data REST API returns the data formatted as JSON.

  8. Retrieve the data from the JSON and display it in your webpage, web portal, or application.



Was this page helpful?