API endpoint | Available from |
---|---|
| ThoughtSpot Cloud ts7.april.cl |
Liveboard data API
To retrieve data related to a Liveboard or visualization from the ThoughtSpot system, you can use the Liveboard data API.
Using this API, you can fetch the following information:
-
All the visualization objects on a Liveboard
-
A specific or a group of visualizations on a Liveboard
Note
|
ThoughtSpot recommends using Liveboard data API to embed ThoughtSpot content within a native mobile app. |
Supported operationsπ
Required permissionsπ
You must have at least view access to the Liveboard and visualization objects.
Request URLπ
POST /tspublic/v1/pinboarddata
Request parametersπ
Query parameter | Description |
---|---|
| String. The GUID of the Liveboard. |
| String. A JSON array of GUIDs of the visualizations. |
| String. If the Liveboard has unsaved changes, pass this parameter in the browser fetch request. |
| Integer. The batch size for loading Liveboard objects. The system default is -1. |
| Integer. An alternate way to define the offset. The system default is -1. The |
| Integer. The system default is -1. You can set an offset value based on the following formula:
For example, if a Liveboard has 10 charts and each chart has 5 columns and 10 records, and the |
| String. Valid values are |
Liveboard data with unsaved changesπ
To download or retrieve a Liveboard with unsaved changes, pass the transient_pinboard_content
script with getExportRequestForCurrentPinboard
method in the browser fetch request.
function getExportRequestForCurrentPinboard(frame: HTMLIframeElement): Promise<string>;
The promise returned resolves to a string that contains the transient Liveboard content, which is encoded as JSON and is sent to the Liveboard API endpoint with the transient content key. This content resembles the current Liveboard as is, including the unsaved changes if any, including unsaved changes to the following:
-
Liveboard filters
-
Runtime filters applied on visualizations on a Liveboard
-
Liveboard layout
If the new Liveboard experience is enabled, the transient content includes ad hoc changes to visualizations such as sorting, toggling of legends, and data drill down.
Sample browser fetch requestπ
< iframe src = "https://ts_host:port/" id = "ts-embed" > < /iframe>
< script src = "/path/to/liveboard.js" > < /script>
< script >
const embed = new LiveboardEmbed("#embed", {
frameParams: {},
});
async function liveboardData() {
const transientPinboardContent = await embed.trigger(HostEvent.getExportRequestForCurrentPinboard);
const liveboardDataResponse = await fetch("https://ts_host:port/callosum/v1/tspublic/v1/pinboarddata", {
method: "POST",
body: createFormDataObjectWith({
"formattype": "COMPACT",
"transient_pinboard_content": transientPinboardContent,
}),
});
}
< /script>
Example requestsπ
Liveboard dataπ
curl -X POST \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/json' \
--header 'X-Requested-By: ThoughtSpot' \
'https://{ThoughtSpot-Host}/callosum/v1/tspublic/v1/pinboarddata?id=f4533461-caa5-4efa-a189-13815ab86770&batchsize=-1&pagenumber=-1&offset=-1&formattype=COMPACT'
https://{ThoughtSpot-Host}/callosum/v1/tspublic/v1/pinboarddata?id=f4533461-caa5-4efa-a189-13815ab86770&batchsize=-1&pagenumber=-1&offset=-1&formattype=COMPACT
Visualization dataπ
curl -X POST \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/json' \
--header 'X-Requested-By: ThoughtSpot'
'https://{ThoughtSpot-Host}/callosum/v1/tspublic/v1/pinboarddata?id=bea79810-145f-4ad0-a02c-4177a6e7d861&vizid=['fa934657-e347-4de7-b02d-3b46609233cc','62f98ad3-6ddd-4aed-8f13-58054295b7e3','eb77ba14-15de-4d4d-aac4-625ebd58b1c6']&batchsize=-1&pagenumber=-1&offset=-1&formattype=COMPACT'
https://{ThoughtSpot-Host}/callosum/v1/tspublic/v1/pinboarddata?id=bea79810-145f-4ad0-a02c-4177a6e7d861&vizid=['fa934657-e347-4de7-b02d-3b46609233cc','62f98ad3-6ddd-4aed-8f13-58054295b7e3','eb77ba14-15de-4d4d-aac4-625ebd58b1c6']&batchsize=-1&pagenumber=-1&offset=-1&formattype=COMPACT
Example responseπ
Each data object returned in the API response contains four components:
-
The
columnNames
array that contains a list of all column headers. -
The
data
array that contains a list of sub-arrays. Each sub-array represents a new row of data. -
Name of the visualization.
-
A sampling ratio.
The sampling ratio tells you the percentage of total data returned. A sampling ratio of
1
indicates that all data in the visualization object was returned in the API response.
Liveboard dataπ
{
"4fdf9d2c-6f34-4e3b-9fa6-bd0ca69676e1": {
"name": "Sample Name",
"columnNames": [
"Opportunity Stage",
"Opportunity Owner Name",
"Total Amount"
],
"data": [
[
"s3 alignment with eb",
"jeff cameron",
1102272
],
[
"s4 validation",
"brian mcquillan",
59150
]
],
"samplingRatio": 1,
"totalRowCount": 14,
"rowCount": 14,
"pageSize": 10,
"offset": 0
}
}
Visualization dataπ
The returned JSON data includes one object for every visualization on the Liveboard. If you make a call to obtain data for a specific visualization on a Liveboard, The API returns data for only that visualization.
{
"fa934657-e347-4de7-b02d-3b46609233cc": {
"columnNames": [
"User"
],
"data": [
[
9
]
],
"samplingRatio": 1,
"totalRowCount": 1,
"rowCount": 1,
"pageSize": -1,
"offset": -1,
"name": "MAU Last 30 Days"
},
"eb77ba14-15de-4d4d-aac4-625ebd58b1c6": {
"columnNames": [
"User",
"Number of User Action"
],
"data": [
[
"tsadmin",
436
],
[
"system",
50
],
[
"cristi-test",
8
],
[
"sandeep2",
7
],
[
"sandeep",
4
]
],
"samplingRatio": 1,
"totalRowCount": 5,
"rowCount": 5,
"pageSize": 100000,
"offset": 0,
"name": "Top 10 Liveboard Consumers Last 30 days"
},
"62f98ad3-6ddd-4aed-8f13-58054295b7e3": {
"columnNames": [
"User"
],
"data": [
[
2
]
],
"samplingRatio": 1,
"totalRowCount": 1,
"rowCount": 1,
"pageSize": -1,
"offset": -1,
"name": "Inactive Users"
}
}
Runtime filtersπ
You can modify the APIβs output by passing runtime filters as parameters in the resource URL.
For example:
https://{ThoughtSpot-Host}/callosum/v1/tspublic/v1/pinboarddata?id=f4533461-caa5-4efa-a189-13815ab86770&batchsize=-1&col1=COL_NAME1&op1=OP_TYPE1&val1=VALUE1&coln=COL_NAMEn&opn=OP_TYPEn&valn=VALUEn
You can add more than one filter by specifying col2
, op2
, val2
, and so on.
Parameter | Definition |
---|---|
col<n> | Name of the column to filter on. |
op<n> | {IN, EQ, NE, LT, LEβ¦β} |
val<n> | Value of the column to filter on. |
Note
|
These parameters are case-insensitive. For example, EQ , eq , and eQ have the same result.
|
Runtime filter operatorsπ
Operator | Description | Number of Values |
---|---|---|
| equals | 1 |
| does not equal | 1 |
| less than | 1 |
| less than or equal to | 1 |
| greater than | 1 |
| greater than or equal to | 1 |
| contains | 1 |
| begins with | 1 |
| ends with | 1 |
| between inclusive of the higher value | 2 |
| between inclusive of the lower value | 2 |
| between inclusive | 2 |
| between non-inclusive | 2 |
| is included in this list of values | multiple |
Response codesπ
HTTP Code | Description |
---|---|
200 | Successful retrieval of Liveboard or visualization data |
400 | Invalid Liveboard ID |