Pinboard export API
To programmatically download a pinboard or specific visualizations from a pinboard as a PDF file, use the /tspublic/v1/export/pinboard/pdf
.
To remove ThoughtSpot logos from the exported PDFs, contact your ThoughtSpot team. |
Request parameters
Form parameter | Description | Default |
---|---|---|
|
String. GUID of the Pinboard to download |
none |
|
Array of strings. A JSON array of GUIDs of the visualizations to include in the PDF in the JSON array format. For example, |
none |
|
String. If the Pinboard has unsaved changes, pass this parameter in the browser fetch request. |
none |
|
String. Layout type for the PDF. Valid values are |
|
|
String. Page orientation for the PDF. Valid values are |
|
|
Boolean. When set to true, only the first page of the tables is displayed in the PDF. This setting is applicable only if the |
|
|
Boolean. Include customized wide logo if available in the footer |
|
|
String. Footer text to include in the footer of each page of the PDF. |
none |
|
Boolean. When set to |
|
|
Boolean. When set to |
|
|
Boolean. When set to |
|
Example request
Make sure the API request has the following headers:
-
The
Accept
header is set asAccept: application/octet-stream
-
The
Content-type
header set asContent-type: multipart/form-data
-
The
X-requested-by
header set asX-Requested-By: ThoughtSpot
curl --location --request POST 'https://<ThoughtSpot-host>/callosum/v1/tspublic/v1/export/pinboard/pdf' \
--header 'Content-Type: multipart/form-data \
--header 'Accept: application/octet-stream' \
--header 'X-Requested-By: ThoughtSpot' \
--header 'Cookie: JSESSIONID=71cc2672-7ead-4480-be7d-b6ad52023e98; userGUID=59481331-ee53-42be-a548-bd87be6ddd4a; Callosum-Download-Initiated=false' \
--form 'id="061457a2-27bc-43a9-9754-0cd873691bf0"' \
--form 'layout_type="PINBOARD"' \
--form 'orientation="LANDSCAPE"' \
--form 'truncate_tables="false"' \
--form 'include_logo="true"' \
--form 'include_page_number="true"' \
--form 'include_filter_page="true"' \
--form 'include_cover_page="true"'
https://<ThoughtSpot-host>/callosum/v1/tspublic/v1/export/pinboard/pdf
Example response
The response appears in the form of a raw pdf file. The response type is application/octet-stream
.
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/export/pinboard/pdf?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. |
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 |
Embedded Pinboard with unsaved changes
If you have embedded ThoughtSpot in your host application, and you want to download Pinboards with unsaved changes as PDFs, pass the transient_pinboard_content
parameter in the browser fetch request, using the getExportRequestForCurrentPinboard
method.
function getExportRequestForCurrentPinboard(frame: HTMLIframeElement): Promise<string>;
The promise returned resolves to a string that contains the transient pinboard content, which is encoded as JSON and is sent to the /tspublic/v1/export/pinboard/pdf
endpoint with the transient_pinboard_content
key. This content resembles the current Pinboard as is, including the unsaved changes.
Sample browser fetch request
<iframe src="http://ts_host:port/" id="ts-embed"></iframe>
<script src="/path/to/ts-api.js"></script>
<script>
const tsFrame = document.getElementById("ts-embed");
async function downloadPDF() {
const transientPinboardContent = await thoughtspot.getExportRequestForCurrentPinboard(tsFrame);
const pdfResponse = await fetch("http://ts_host:port/callosum/v1/tspublic/v1/export/pinboard/pdf", {
method: "POST",
body: createFormDataObjectWith({
"layout_type": "PINBOARD",
"transient_pinboard_content": transientPinboardContent,
}),
});
// Do something with pdfResponse.blob()
}
</script>
Response codes
HTTP status code | Description |
---|---|
200 |
Streaming output for pinboard pdf |
400 |
Invalid parameter values |
403 |
No read access for pinboard |
404 |
Object not found |