Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions modules/ROOT/pages/common/nav-rest-api.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,25 @@ REST APIs
* link:{{navprefix}}/api-authv2[REST API v2.0 authentication]
* link:{{navprefix}}/rest-v2-changelog[REST API v2 changelog]
* link:{{navprefix}}/restV2-playground?apiResourceId=http%2Fgetting-started%2Fintroduction[REST API v2 Playground]
* link:{{navprefix}}/api-user-management[Users and group privileges]
* link:{{navprefix}}/rbac[Role-based access control]
* link:{{navprefix}}/rest-apiv2-search[Search API endpoints]
** link:{{navprefix}}/rest-apiv2-users-search[Search users]
** link:{{navprefix}}/rest-apiv2-groups-search[Search groups]
** link:{{navprefix}}/rest-apiv2-metadata-search[Search metadata]
* link:{{navprefix}}/fetch-data-and-report-apis[Data and Report APIs]
* link:{{navprefix}}/spotter-api[Spotter APIs]
** link:{{navprefix}}/spotter-agent-apis[AI APIs (Spotter Agent and Spotter 3)]
** link:{{navprefix}}/spotter-apis-classic[AI APIs (Spotter Classic) ^BETA^]
** link:{{navprefix}}/spotter-coaching-apis[Spotter coaching APIs ^BETA^]
* link:{{navprefix}}/audit-logs[Audit logs]
* link:{{navprefix}}/tml[TML]
* link:{{navprefix}}/collections[Collections ^BETA^]
* link:{{navprefix}}/connections[Connections]
* link:{{navprefix}}/connection-config[Connection configuration]
* link:{{navprefix}}/runtime-sort[Runtime sorting]
* link:{{navprefix}}/rest-apiv2-reference[REST API v2.0 Reference]
** link:{{navprefix}}/api-user-management[Users and group privileges]
** link:{{navprefix}}/rbac[Role-based access control]
** link:{{navprefix}}/rest-apiv2-search[Search API endpoints]
*** link:{{navprefix}}/rest-apiv2-users-search[Search users]
*** link:{{navprefix}}/rest-apiv2-groups-search[Search groups]
*** link:{{navprefix}}/rest-apiv2-metadata-search[Search metadata]
** link:{{navprefix}}/fetch-data-and-report-apis[Data and Report APIs]
** link:{{navprefix}}/spotter-api[Spotter APIs]
*** link:{{navprefix}}/spotter-agent-apis[AI APIs (Spotter Agent and Spotter 3)]
*** link:{{navprefix}}/spotter-apis-classic[AI APIs (Spotter Classic) ^BETA^]
*** link:{{navprefix}}/spotter-coaching-apis[Spotter coaching APIs ^BETA^]
** link:{{navprefix}}/style-customization-apis[Customize styles using APIs]
** link:{{navprefix}}/audit-logs[Audit logs]
** link:{{navprefix}}/tml[TML]
** link:{{navprefix}}/collections[Collections ^BETA^]
** link:{{navprefix}}/connections[Connections]
** link:{{navprefix}}/connection-config[Connection configuration]
** link:{{navprefix}}/runtime-sort[Runtime sorting]


[.sidebar-title]
Expand Down
344 changes: 344 additions & 0 deletions modules/ROOT/pages/customize-style-api.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,344 @@
= Customize UI layout and styles through REST APIs
:toc: true
:toclevels: 2

:page-title: Customize styles and layout through REST APIs
:page-pageid: style-customization-apis
:page-description: Customize styles, design, and layout of embedded ThoughtSpot app using REST APIs

// SOURCE: SCAL-293070, SCAL-293071

//[earlyAccess eaBackground]#Early Access#

ThoughtSpot provides REST API v2.0 endpoints to manage style customization settings programmatically. These APIs expose the same branding and theming controls available in the *Develop* > *Customizations* > *Styles* page, enabling you to automate branding and white-labeling — including across multiple Orgs — without logging in to the ThoughtSpot UI.

[NOTE]
====
All style customization API endpoints require administrator or developer privileges.
====

=== Style configuration

Use the following endpoints to search and update style settings at the cluster or Org scope.

==== Search style configuration
To get the current style configuration for the cluster and the active Org send an API request to `POST /api/rest/2.0/customization/styles/search` endpoint.
When called from the Primary Org (Org 0), the response returns one record with `"scope": "CLUSTER"` and one with `"scope": "ORG"`.

==== Update style configuration
To update the style settings send an API request to `POST /api/rest/2.0/customization/styles/update` endpoint.
Request parameters::

[cols="2,1,4"]
|=====
|Parameter|Required|Description
|`scope`|Yes|`CLUSTER` or `ORG`.
//|`org_identifier`|Conditional|Required when `scope` is `ORG`.
|`operation`|Yes|`REPLACE` overwrites existing settings. `RESET` reverts specific fields to defaults.
|`navigation_panel`|No|Top navigation panel color. Use `"theme": "CUSTOM"` with a valid hex value in `"base_color"`.
|`chart_color_palette`|No|Array of hex color values for charts. When provided with `REPLACE`, exactly 8 color entries must be specified in colors.
|`embedded_footer_text`|No|Footer text for embedded content.
|`visualization_fonts`|No|Font assignments for visualization elements. Provide only the areas to update; omitted areas remain unchanged.
|`default_logo`|No|Binary image file for the square application logo.
|`wide_logo`|No|Binary image file for the wide logo (email and PDF exports).
|`reset_options`|No|Resets specified settings to ThoughtSpot defaults.
|=====

Example request:: To set a custom navigation panel color at cluster scope


[source,cURL]
----
curl -X POST \
--url 'https://{ThoughtSpot-Host}/api/rest/2.0/customization/styles/update' \
-H 'Authorization: Bearer {access-token}'\
-H 'Accept: application/json'\
-H 'Content-Type: application/json' \
--data-raw '{
"scope": "CLUSTER",
"operation": "REPLACE",
"navigation_panel": {
"theme": "CUSTOM",
"base_color": "#2359B6"
}
}
----

Example request:: To update chart color palette for a specific Org (MERGE)

[source,cURL]
----
curl -X POST \
--url 'https://{ThoughtSpot-Host}/api/rest/2.0/customization/styles/update' \
-H 'Authorization: Bearer {access-token}'\
-H 'Accept: application/json'\
-H 'Content-Type: application/json' \
--data-raw '{
"scope": "ORG",
"org_identifier": "Sales Org",
"operation": "REPLACE",
"chart_color_palette": {
"colors": [
{"color": "#FF6B35"},
{"color": "#004E89"},
{"color": "#1A936F"},
{"color": "#C6D8D3"},
{"color": "#F18F01"},
{"color": "#8B4513"},
{"color": "#6A0572"},
{"color": "#2E8B57"}
],
"disable_color_rotation": false
}
}
----

=== Custom fonts

==== Upload a custom font
To upload a font file (multipart/form-data) send an API request to `POST /api/rest/2.0/customization/styles/fonts/upload` endpoint.

Request parameters::

[cols="2,1,4"]
|=====
|Parameter|Required|Description

|`scope`
|No
|Scope of the font library. Valid values: `CLUSTER`, `ORG`.
Defaults to `ORG` when Orgs are enabled; defaults to `CLUSTER` when Orgs are disabled.

|`org_identifier`
|Conditional
|Unique ID or name of the Org. Applicable only when `scope` is `ORG`.
Defaults to the currently logged-in user's Org if omitted.

|`name`
|Yes
|Display name for the font. Must be unique within the target scope.

|`file_content`
|Yes
|Binary font file. Accepted formats: WOFF and WOFF2 only.

|`weight`
|No
|Font weight. Valid values: `NORMAL`, `LIGHT`, `BOLD`.

|`style`
|No
|Font style. Valid values: `NORMAL`, `ITALIC`, `OBLIQUE`.

|`color`
|No
|Default color for the font as a 6-digit hex string. Example: `#333333`.

|=====

Example Request::
[source,cURL]
----
curl -X POST 'https://{your-thoughtspot-host}/api/rest/2.0/customization/styles/fonts/upload' \
-H 'Authorization: Bearer {token}' \
-H 'Accept: application/json' \
-F 'name=Acme Sans' \
-F 'weight=BOLD' \
-F 'style=NORMAL' \
-F 'color=#333333' \
-F 'file_content=@/path/to/acme-sans-bold.woff2'
----


==== Search style fonts
To get custom fonts uploaded to the instance or the Org, send an API request to the `POST /api/rest/2.0/customization/styles/fonts/search` endpoint.

Request parameter::
[cols="2,1,4"]
|=====
|Parameter|Required|Description

|`scope`
|Yes
|Scope of the font library. Valid values: `CLUSTER`, `ORG`.


|`font_identifier`
|No
|Filter by exact font GUID or exact display name (case-insensitive).
Cannot be used together with `name_pattern`.

|`name_pattern`
|No
|Filter by partial, case-insensitive substring match on font display name.
Cannot be used together with `font_identifier`.

|`include_font_assignments`
|No
|If `true`, each font in the response includes the visualization areas it is assigned to.
Default: `false`.

|=====

////
|`org_identifier`
|Conditional
|Unique ID or name of the Org. Applicable only when `scope` is `ORG`.
Defaults to the caller's active Org if omitted.
////


Example API request::
Return all fonts with their visualization assignments

[source,cURL]
----
curl -X POST \
--url 'https://{ThoughtSpot-Host}/api/rest/2.0/customization/styles/fonts/search' \
-H 'Authorization: Bearer {access-token}'\
-H 'Accept: application/json'\
-H 'Content-Type: application/json' \
--data-raw '{
"scope": "CLUSTER",
"include_font_assignments": true
}
----
Example API request:: Filter by name pattern
[source,cURL]
----
curl -X POST \
--url 'https://{ThoughtSpot-Host}/api/rest/2.0/customization/styles/fonts/search' \
-H 'Authorization: Bearer {access-token}'\
-H 'Accept: application/json'\
-H 'Content-Type: application/json' \
--data-raw '{
"scope": "ORG",
"org_identifier": "Sales Org",
"name_pattern": "acme",
"include_font_assignments": false
}
----

==== Update a custom font
To update an existing font's display name, weight, style, or color send an API request to the `POST /api/rest/2.0/customization/styles/fonts/{font_identifier}/update` endpoint.

Request parameters::

[cols="2,1,4"]
|=====
|Parameter|Required|Description

|`font_identifier`
|Yes
|GUID or display name of the font to update. Passed as a path parameter.

|`scope`
|Yes
|Scope of the font library. Valid values: `CLUSTER`, `ORG`.

|`name`
|No
|New display name for the font. Omit to leave unchanged.

|`weight`
|No
|Updated font weight. Valid values: `NORMAL`, `LIGHT`, `BOLD`.
Omit to leave unchanged.

|`style`
|No
|Updated font style. Valid values: `NORMAL`, `ITALIC`, `OBLIQUE`.
Omit to leave unchanged.

|`color`
|No
|Updated default color as a 6-digit hex string. Example: `#333333`.
Omit to leave unchanged.

|=====

Example API request:: Filter by name pattern
[source,cURL]
----
curl -X POST \
--url 'https://{ThoughtSpot-Host}/api/rest/2.0/customization/styles/fonts/a1b2c3d4-e5f6-7890-abcd-ef1234567890/update' \
-H 'Authorization: Bearer {access-token}'\
-H 'Accept: application/json'\
-H 'Content-Type: application/json' \
--data-raw '{
"scope": "CLUSTER",
"name": "Acme Sans Revised",
"weight": "SEMI_BOLD",
"color": "#111111"
}

----

==== Delete custom fonts
To delete one or more custom fonts from the font library send an API request to the `POST /api/rest/2.0/customization/styles/fonts/delete` endpoint.

Request parameter::
[cols="2,1,4"]
|=====
|Parameter|Required|Description

|`scope`
|Yes
|Scope of the font library. Valid values: `CLUSTER`, `ORG`.


|`font_identifiers`
|Yes
|List of font GUIDs or display names to delete.
Duplicate values are deduplicated automatically.

|`dry_run`
|No
|If `true`, returns the list of affected visualization assignments without deleting any fonts. When a font is deleted, all visualization areas that used it are automatically reset to the system default font.
Default: `true`. Set to `false` to commit the deletion.

|=====

////
|`org_identifier`
|Conditional
|Unique ID or name of the Org. Applicable only when `scope` is `ORG`.
Defaults to the caller's active Org if omitted.
////


Example API request::

[source,cURL]
----
curl -X POST \
--url 'https://{ThoughtSpot-Host}/api/rest/2.0/customization/styles/fonts/delete' \
-H 'Authorization: Bearer {access-token}'\
-H 'Accept: application/json'\
-H 'Content-Type: application/json' \
--data-raw '{
"scope": "CLUSTER",
"font_identifiers": [
"a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"b2c3d4e5-f6a7-8901-bcde-f12345678901"
],
"dry_run": true
}
----

=== Logo export
To get the configured logos at the requested scope as a ZIP archive containing the default and wide logo images, send an API request to the `POST /api/rest/2.0/customization/styles/logos/export` endpoint.

Example API request::

[source,cURL]
----
curl -X POST \
--url 'https://{ThoughtSpot-Host}/api/rest/2.0/customization/styles/fonts/delete' \
-H 'Authorization: Bearer {access-token}'\
-H 'Accept: application/json'\
-H 'Content-Type: application/json' \
--data-raw '{
"scope": "CLUSTER"
}
----
Loading