Skip to content

Commit

Permalink
Move asciidoc files to docs/src/asciidocs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayon Ghosh committed Feb 5, 2021
1 parent 687d7f9 commit 21b79de
Show file tree
Hide file tree
Showing 15 changed files with 2,000 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/src/asciidocs/about-rest-apis.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
== REST APIs
ThoughtSpot APIs are documented in the ThoughtSpot Documentation. You can also find details about the APIs and test many of them using Swagger. To access Swagger, first, login as a user with Administrator credentials. Then navigate to https://<your-thoughtspot.com>/external/swagger. You will get a list of all publicly available services.


You can click on a header to expand and get the list of services. Clicking on a service name provides more details about the service.
122 changes: 122 additions & 0 deletions docs/src/asciidocs/authentication.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
== Authentication
:toc: true

You can control which type of authentication you use between your client application and ThoughtSpot.

=== No Authentication

You can simply not set up authentication.
This would require the user to be _already logged into ThoughtSpot_, before interacting with the client application.
This approach is for testing the client.
Do not use this in a production environment.

=== SAML SSO

To avoid showing the ThoughtSpot login page in the iFrame and provide a seamless login experience, you should configure SSO so that your users are automatically authenticated to ThoughtSpot, and the pages are loaded immediately.

Before you can embed all or part of ThoughtSpot, you must authenticate to ThoughtSpot using SAML with the public REST API call.

////
For more information, see https://cloud-docs.thoughtspot.com/admin/ts-cloud/authentication-integration.html[Managing authentication with SAML].
Note that this does not assign the user to any groups, which must be managed manually or via the APIs.
After authentication, a URL is provided to call the desired visualization, and populate it into an `<iframe>` element.
You must link:{{ site.baseurl}}/admin/setup/configure-SAML-with-tscli.html[configure SAML] on your ThoughtSpot instance before using this method.
////

=== Trusted authentication service

A ThoughtSpot installation can enable support for token-based authentication service.
This allows an installation to use a central authentication service rather than using ThoughtSpot to authenticate.
In this architecture, ThoughtSpot provides the service with a token that allows it to authenticate on behalf of users.

A trusted authenticator application or service obtains a token from ThoughtSpot.
This token is used to obtain trust from other third-party client applications that need access to ThoughtSpot.
In the following scenario, the trust authenticator forwards requests for ThoughtSpot data from client applications to ThoughtSpot.

==== Enable Trusted Authentication

If you are using Trusted Authentication, enable this capability from the command line:
[source,console]
----
$ tscli tokenauthentication enable
----
This command turns on trusted authentication and returns something like the following:
[source,console]
----
Token generated. Copy the GUID in the box.
########################################
# b0cb26a0-351e-40b4-9e42-00fa2265d50c #
########################################
Override added successfully
----

The key inside the hashes is the ThoughtSpot secret key. This key is needed to make calls to get a token for an individual user.

To disable trusted authentication, run the following command at the command line:

[source,console]
----
$ tscli tokenauthentication disable
----

This command disables token authentication and the secret token.

For more information, see
https://docs.thoughtspot.com/6.3/app-integrate/embedding-viz/trusted-authentication.html[Configure trusted authentication].
////
==== Trusted Authentication Workflow
. The user will log into the web application using the customer provided authentication capabilities.
. The trusted authentication service calls the ThoughtSpot service to log in, using a service account that has admin privileges. This step creates a session for the next call.
. After establishing a session, the token service will make calls to ThoughtSpot to get a token for the user using the +session/login/token +service.
. On success, the token service returns a unique token for future calls on behalf of the user.
The user is now authenticated, though the calls take a special format as described below.
A user who is already logged into client-application interacts with a ThoughtSpot embed point, which initiates the following processes:
. The client-side application requests a user token from the trusted authenticator.
. The trusted authenticator requests a user token from ThoughtSpot.
. ThoughtSpot verifies the authenticator and returns a user token.
. The authenticator returns the user token to the client.
. The client forwards the user token to ThoughtSpot.
. ThoughtSpot validates the token and returns information commensurate with that authenticated user's authorization.
== Cross-origin HTTP Requests (CORS)
Collecting user credentials from one application (domain) and sending them to another application (such as ThoughtSpot) can present security vulnerabilities.
Cross-origin or cross-domain verification prevents such security risks.
When embedding, you must enable CORS between your client application domain and the ThoughtSpot domain.
This protects your data, so that another actor cannot use the same URL to embed the visualization in its own Web pages.
== Decide if you need to change the feedback email
ThoughtSpot has an automated feature that collects feedback from users and sends it to ThoughtSpot Support.
Depending on what and how you embed, user actions with your embedded application can trigger feedback.
You can continue to forward feedback in this manner or direct the feedback to another email.
To learn how to change the feedback email, see link:{{site.baseurl }}/admin/setup/work-with-ts-support.html#manage-the-feedback-contact[Manage the feedback contact].
== Remove the ThoughtSpot branded footer
The ThoughtSpot footer appears by default in the ThoughtSpot application.
It also appears with an embed application that encompasses an individual Pinboard, or a full application.
In embed applications that are have a single visualization, you can ask your ThoughtSpot support engineer to disable the footer.
To embed with the navigation bar, call: +https://<thoughtspot-url>?embedApp=false#/+ +
To embed without the navigation bar, call: +https://<thoughtspot-url>?embedApp=true#/+
If you use +embedApp=true+ with this link, you will get the home page with no navigation bar, so you will need to provide navigation to use ThoughtSpot.
////
110 changes: 110 additions & 0 deletions docs/src/asciidocs/calling-rest-api.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
= Calling the Data REST API
:last_updated: 11/18/2019


Learn how to call the Data REST API.

To call the Data REST API, you can specify a URL using the POST method, passing the ID numbers of the objects from which you want to obtain data.

== Specify the pinboard or visualization example

For a pinboard, you can append the ID of your pinboard as a parameter, like this example:

----
https://<thoughtspot_server>/callosum/v1/tspublic/v1/pinboarddata?id=7752fa9e-db22-415e-bf34-e082c4bc41c3
----

To retrieve data from a specific visualization within a pinboard, you would append the ID number of the visualization using the vizid parameter:

----
https://<thoughtspot_server>/callosum/v1/tspublic/v1/pinboarddata?id=7752fa9e-db22-415e-bf34-e082c4bc41c3&vizid=%5B1e99d70f-c1dc-4a52-9980-cfd4d14ba6d6%5D
----

*Remember:* You must add brackets around the vizid parameter.
The URL encoding for open bracket is `%5B`, and the URL encoding for close bracket is `%5D`.

== Object Format for Returned Data

When you parse the returned JSON data you can see that there is one object for every viz on the pinboard.
The objects are named according to the corresponding vizid.

image::parsed_json_data.png[]

If you make a call to a specific viz on a pinboard, it will return just one object.
The JSON object format for the data that is returned from ThoughtSpot is:

----
{
vizId1 : {
name: “Viz name”,
:[[2-d array of data values], [], [] …..[]],
columnNames:[col1, col2, …. ],
samplingRatio: n
},
vizId2 : {
.
}
}
----

Each object contains four components:

. An array of column headers.
. An array of data.
. The name given to the specific viz.
. And a sampling ratio.
The sampling ratio tells you the percentage of total data returned.
`1` would mean all data in the viz was returned in the API call.

The `columnNames` array contains a list of all column headers.
And the `data` array contains a list of other arrays.
Each sub array represents a new row of data.

image::columnnames_and_data_arrays.png[]

The REST API supports filtering the data returned through parameters that you pass within the URL.
These are called link:{{ site.baseurl }}/app-integrate/runtime-filters/about-runtime-filters.html#[Runtime Filters].

== Example

The following example shows a JavaScript function that calls the REST API, gets the results back, and retrieves a single value from the JSON results:

----
/**
* Generates headline by making a data API call.
*
* @param void
* @return void
*/
function generateHeadline(filters) {
var pinboardId = "0aa0839f-5d36-419d-b0db-10102131dc37";
var vizId = "67db30e8-06b0-4159-a748-680811d77ceb";
var myURL = "";
if (filters === void 0) {
myURL = "http://192.168.2.55:443/callosum/v1/tspublic/v1/" +
"pinboarddata?id=" + pinboardId + "&" +
"vizid=%5B" + vizId + "%5D";
} else {
var query = getQueryString(filters);
myURL = "http://192.168.2.55:443/callosum/v1/tspublic/v1/" +
"pinboarddata?id=" + pinboardId + "&" + +
"vizid=%5B" + vizId + "%5D&" + query;
}
var jsonData = null;
var xhr = new XMLHttpRequest();
xhr.open("POST", myURL, true);
xhr.withCredentials = true;
xhr.onreadystatechange = function() {
var headline = document.getElementById("embeded-headline");
if (xhr.readyState == 4 && xhr.status == 200) {
jsonData = JSON.parse(xhr.responseText);
headline.innerHTML = jsonData[vizId].data[0][0];
} else {
headline.innerHTML = "Error in getting data !!!";
}
};
xhr.send();
}
----
95 changes: 95 additions & 0 deletions docs/src/asciidocs/customize-style.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
= Customize look and feel
:toc: true


You can brand the ThoughtSpot application for your company.

You can customize the look and feel of the ThoughtSpot application for your company.
Configuring these settings sets system-wide defaults for all your users.

Style customization is enabled by default.
You can configure your cluster to disable this functionality.

////
Contact https://community.thoughtspot.com/customers/s/contactsupport[ThoughtSpot Support] about disabling this feature.

////

== Customize styles

To customize the styles, look and feel of the ThoughtSpot application components, you must be an authorized user with administrative privileges.

To access style customization:

. Go to the SpotDev portal.
. Sign in with your ThoughtSpot user credentials.
. Under *Configuration*, click *Style Customization*.

== General guidelines for customization

Your changes take effect either immediately, or after you refresh the browser.
You can revert your changes by using the *Reset* button that appears when you move your cursor to the right of the setting.


You can configure these style customizations:

* Application Logo (Default) & Favicon
* Font style for chart labels
* Set the background for the embedded ThoughtSpot component
* Set the default palette for all charts.

////
Sets a default application and favicon logo.
This should be 140 pixels square.+++</dlentry>++++++<dlentry>+++Application Logo (Wide):::: This logo should be 440 x 100 pixels.+++</dlentry>++++++<dlentry>+++Chart Visualization Fonts::::
You can specify any Web Open Font Format (`WOFF`) file.+++</dlentry>++++++<dlentry>+++Table Visualization Fonts::::
Set a font for table labels.
You can specify any Web Open Font Format (`WOFF`) file.+++</dlentry>++++++<dlentry>+++Embedded Application Background::::
Set the background for an embedded ThoughtSpot instance.
This is only used if you are embedding ThoughtSpot in another application.+++</dlentry>++++++<dlentry>+++Chart Color Palettes::::
Set the default palette for all charts.
To set a value, however over a color value and enter a HEX value or select one from the chart.
Individual users can still customize their own chart colors.
They can use the *Reset colors* option on a chart to clear their changes.+++</dlentry>++++++<dlentry>+++Footer text:::: Define a footer to appear with the ThoughtSpot application.+++</dlentry>++++++<dlentry>+++Page title:::: Sets the title for the browser tab.+++</dlentry>+++
////

== How to specify fonts

You can set your systems default fonts by specifying either or both of the *Chart Visualization Fonts* and *Table Visualization Fonts* values.
To set this values, your font must be defined in a Web Open Font Format (`WOFF`) file.

Changes to chart and table defaults apply only to charts and features created _after_ you configure a value.
If you change table fonts, older tables retain their previous fonts.
Some settings can be overridden on a per-object level.
Users cannot configure their own defaults.

. Make sure you have a WOFF file available for your font.
. Select the label you want to change.
. Click the *+* button.
+
The system displays the *Custom Font* dialog.

. Click the *Custom Font* field.
+
The system displays the file finder.

. Add the `WOFF` file you want.
+
The file appears in the font dialog

. Click *Save* to change the font.

== How to specify the behavior or clickable links in data

There is a system-wide setting which determines what happens when a user clicks on a link within the data.
When your data includes URLs, they display as clickable links in ThoughtSpot tables.
By default, clicking on a link opens the URL in a separate tab.
But there is a system-wide setting that can be changed to open the links within the context of where they appear.

Consider how the links open, by type:

* Link in search result table in ThoughtSpot-Same browser tab as ThoughtSpot application
* Link in table embedded in an <iframe> - Same <iframe> that contains the table
* Link in full ThoughtSpot application embedded in an <iframe> - Same <iframe> that contains the application
60 changes: 60 additions & 0 deletions docs/src/asciidocs/embed-a-viz.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
= Embed charts and tables
:toc: true

This page explains, through an example, how to embed either a ThoughtSpot visualization (table or chart) in your Web page, portal, or application.
////
To build this sample, you must have access to a text editor and a ThoughtSpot instance with a visualization.
Experience working with Javascript also helps.
////
=== Import the SDK Library

[source,javascript]
----
<add codeblock>
----

=== Initialize the SDK

[source,javascript]
----
<add codeblock>
----
=== Construct the embed content

[source,JavaScript]
----
var protocol = "THOUGHTSPOT_PROTOCOL";
var hostPort = "HOST_PORT";
var vizualizationId = "VIZUALIZATON_ID";
----

. Edit each variable in the section and replace it with the IDs you copied from the pinboard.

For example, your URL may look similar to the following:

----
http://172.18.202.35:8088/#/embed/viz/061457a2-27bc-43a9-9754-0cd873691bf0/9985fccf-b28d-4262-b54b-29619a38348e+`
----
This is a link copied from an individual visualization, the result in the file is:


[source,JavaScript]
----
var protocol = "http";
var hostPort = "172.18.202.35:8088";
var pinboardId = "061457a2-27bc-43a9-9754-0cd873691bf0";
var vizualizationId = "9985fccf-b28d-4262-b54b-29619a38348e";
----


=== Configure Events

<Add information on events>


== Verify the embed connection
<Add steps to test visualization embedding>

Loading

0 comments on commit 21b79de

Please sign in to comment.