Before you start using REST APIs, perform the following checks:
Your client application domain is added as a Cross-Origin Resource Sharing (CORS) host in the ThoughtSpot Developer portal.
After you add your host domain for CORS, ThoughtSpot adds the
access-control-allow-originheader in its API responses.
You have valid login credentials and access privileges to run the operations.
If trusted authentication is enabled on your instance, you must obtain an authentication token and include it in your subsequent login requests.
To access REST APIs on Swagger:
Log in to your ThoughtSpot instance.
Access the Swagger portal.
To access Swagger UI, change your URL as shown below:
Go to Swagger Portal The portal displays a list of REST API services available for the logged-in ThoughtSpot users.
Click on a header to expand and view the list of services.
Click on a service name to view more details about the API service.
To explore an API, click Try it out.
API requests and response
To call a REST API, send a request to the endpoint URL with the attributes required to create, view, or modify an object.
Specify the HTTP request method for the Create, Read, Update and Delete (CRUD) operation in your request to the API endpoint. For example, GET, POST, PUT, or DELETE.
A query string consists of additional parameters that are passed in the URL. For example, the
/tspublic/v1/metadata/listobjectheaders API endpoint requires query parameters that are passed as a query string in the URL.
Make sure you include the
'X-Requested-By': 'ThoughtSpot'header in all API requests.
application/jsonfor JSON and
text/plainfor plain text.
Some complex POST operations, such as sharing an object with another user, require the URL-encoded objects to be passed as parameters in the URL. For such API requests, use the
Some APIs use
multipart/form-data for POST requests and require you to provide an input file as a payload. To know if an API uses
multipart/form-data content-type, see the corresponding API description page.
For each API request, ThoughtSpot sends a response. The API response includes either an HTTP status code or a response body in the JSON or plain text format.
For more information about the REST API request URL, parameters, headers, and sample response, see REST API Reference.