From 584c0de3fa8b889b0243721c68843a20273cba66 Mon Sep 17 00:00:00 2001 From: "bryant.howell" Date: Thu, 21 Aug 2025 12:31:50 -0500 Subject: [PATCH 1/4] Start of template/variables work --- src/thoughtspot_rest_api_v1/tsrestapiv2.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/thoughtspot_rest_api_v1/tsrestapiv2.py b/src/thoughtspot_rest_api_v1/tsrestapiv2.py index aabbdbf..0aec238 100644 --- a/src/thoughtspot_rest_api_v1/tsrestapiv2.py +++ b/src/thoughtspot_rest_api_v1/tsrestapiv2.py @@ -1000,4 +1000,7 @@ def ai_analytical_questions(self, request: Dict): endpoint = 'ai/analytical-questions' return self.post_request(endpoint=endpoint, request=request) +# +# /template/variables endpoints +# From b75fe56ca6e1f68c27b3be79a00e13d635dd3851 Mon Sep 17 00:00:00 2001 From: "bryant.howell" Date: Tue, 26 Aug 2025 09:54:38 -0500 Subject: [PATCH 2/4] Added template/variables endpoints --- setup.cfg | 2 +- src/thoughtspot_rest_api_v1/_version.py | 2 +- src/thoughtspot_rest_api_v1/tsrestapiv2.py | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 657dcb7..fde03ae 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = thoughtspot_rest_api_v1 -version = 1.8.6 +version = 1.8.7 description = Library implementing the ThoughtSpot V1 REST API long_description = file: README.md long_description_content_type = text/markdown diff --git a/src/thoughtspot_rest_api_v1/_version.py b/src/thoughtspot_rest_api_v1/_version.py index 871921a..655be52 100644 --- a/src/thoughtspot_rest_api_v1/_version.py +++ b/src/thoughtspot_rest_api_v1/_version.py @@ -1 +1 @@ -__version__ = '1.8.6' +__version__ = '1.8.7' diff --git a/src/thoughtspot_rest_api_v1/tsrestapiv2.py b/src/thoughtspot_rest_api_v1/tsrestapiv2.py index 0aec238..dbbf902 100644 --- a/src/thoughtspot_rest_api_v1/tsrestapiv2.py +++ b/src/thoughtspot_rest_api_v1/tsrestapiv2.py @@ -1004,3 +1004,23 @@ def ai_analytical_questions(self, request: Dict): # /template/variables endpoints # + def template_variables_create(self, request: Dict): + endpoint = 'template/variables/create' + return self.post_request(endpoint=endpoint, request=request) + + def template_variables_delete(self, identifier: str): + endpoint = 'template/variables/{}/delete'.format(identifier) + return self.post_request(endpoint=endpoint) + + def template_variables_search(self, request: Dict): + endpoint = 'template/variables/search' + return self.post_request(endpoint=endpoint, request=request) + + def template_variables_update(self, identifier: str, request: Dict): + endpoint = 'template/variables/{}/update'.format(identifier) + return self.post_request(endpoint=endpoint, request=request) + + # Allows updating multiple values at once + def template_variables_values_update(self, request: Dict): + endpoint = 'template/variables/update' + return self.post_request(endpoint=endpoint, request=request) \ No newline at end of file From f5217e03405fe37ed26a7ce259dc584ae80c4558 Mon Sep 17 00:00:00 2001 From: "bryant.howell" Date: Tue, 26 Aug 2025 10:25:38 -0500 Subject: [PATCH 3/4] Added security_metadata_publish() and security_metadata_unpublish --- src/thoughtspot_rest_api_v1/tsrestapiv2.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/thoughtspot_rest_api_v1/tsrestapiv2.py b/src/thoughtspot_rest_api_v1/tsrestapiv2.py index dbbf902..dd7f160 100644 --- a/src/thoughtspot_rest_api_v1/tsrestapiv2.py +++ b/src/thoughtspot_rest_api_v1/tsrestapiv2.py @@ -759,6 +759,14 @@ def security_metadata_share(self, request: Dict): endpoint = 'security/metadata/share' return self.post_request(endpoint=endpoint, request=request) + def security_metadata_publish(self, request: Dict): + endpoint = 'security/metadata/publish' + return self.post_request(endpoint=endpoint, request=request) + + def security_metadata_unpublish(self, request: Dict): + endpoint = 'security/metadata/unpublish' + return self.post_request(endpoint=endpoint, request=request) + # # /data/ # @@ -912,6 +920,10 @@ def customization_custom_actions_delete(self, custom_action_identifier: str): endpoint = 'customization/custom-actions/{}/delete'.format(custom_action_identifier) return self.post_request(endpoint=endpoint) +# +# /customization/email +# + # # /schedules/ endpoints # @@ -1023,4 +1035,5 @@ def template_variables_update(self, identifier: str, request: Dict): # Allows updating multiple values at once def template_variables_values_update(self, request: Dict): endpoint = 'template/variables/update' - return self.post_request(endpoint=endpoint, request=request) \ No newline at end of file + return self.post_request(endpoint=endpoint, request=request) + From 2c892471254c2e23ff65e886f412143be8100388 Mon Sep 17 00:00:00 2001 From: "bryant.howell" Date: Wed, 27 Aug 2025 14:53:06 -0500 Subject: [PATCH 4/4] Added accept_language property for updating the Accept-Language header. This affects /searchdata and other endpoints in terms of locale based formatting of strings --- src/thoughtspot_rest_api_v1/tsrestapiv2.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/thoughtspot_rest_api_v1/tsrestapiv2.py b/src/thoughtspot_rest_api_v1/tsrestapiv2.py index dd7f160..95c9506 100644 --- a/src/thoughtspot_rest_api_v1/tsrestapiv2.py +++ b/src/thoughtspot_rest_api_v1/tsrestapiv2.py @@ -47,8 +47,11 @@ def __init__(self, server_url: str): # X-Requested-By is necessary for all calls. # Accept: application/json isn't necessary with requests (default: Accept: */*) but might be in other frameworks # + self.__accept_language = "en-US" # This sets the header on any subsequent call - self.api_headers = {'X-Requested-By': 'ThoughtSpot', 'Accept': 'application/json', 'Accept-Language': 'en_US'} + self.api_headers = {'X-Requested-By': 'ThoughtSpot', + 'Accept': 'application/json', + 'Accept-Language': self.__accept_language} self.requests_session.headers.update(self.api_headers) # Will be set after initial request @@ -77,6 +80,16 @@ def bearer_token(self, bearer_token): self.api_headers['Authorization'] = 'Bearer {}'.format(bearer_token) self.requests_session.headers.update(self.api_headers) + @property + def accept_language(self): + return self.__accept_language + + @accept_language.setter + def accept_language(self, accept_language_code): + self.__accept_language = accept_language_code + self.api_headers['Accept-Language'] = accept_language_code + self.requests_session.headers.update(self.api_headers) + # # Session management calls # - up here vs. in the SESSION section below (because these two are required)