Author: Manish Tomar
What is Sigma Computing API?
Sigma's computing API is a powerful RESTful API that grants developers the ability to programmatically tap into Sigma's robust capabilities. With the API, developers can easily create, modify, and delete objects such as connections, workspace, and teams, in addition to carrying out essential operations like swapping data sources and creating workbooks.
How can Sigma Computing API be used?
The Sigma computing API is highly flexible due to its RESTful nature. Therefore, it can be utilized with a broad spectrum of programming languages and frameworks, enabling developers to leverage their preferred tools and technologies to build custom applications and integrations.
The Sigma Computing API facilitates the automation of various tasks, such as creating and updating connections, running queries, managing workbooks, and more. This section of the article delves into the Sigma Computing API's supported endpoints and how they streamline data management and analysis workflows.
The Connection API endpoints allow you to create, update, list, delete and test a data warehouse connection.
The Connection Path API endpoints helps to locate the path to a database (if applicable to your CDW provider), schema, or table in the connection.
The Connection Grants API endpoints can be used to grant access, list access, and also to delete grants to a connection.
The Workbooks API endpoints allow you to create, update, list, delete, and export workbooks.
The Dataset API endpoints may be used to fetch all existing datasets or individual datasets.
Note: Datasets are a Sigma document type used for data modeling.
The Queries API endpoint allows you to download the result of a successful query.
Note: For security and privacy reasons, by default, the queryId expires 1 hour after your export request has been processed by our system and the file has become ready for download.
The Teams API endpoints offer a range of functions, including creating, updating, listing, and deleting teams. When used in conjunction with the Grant endpoint, these endpoints can be particularly useful for setting up Role-Based Access Control (RBAC) on the Sigma Platform.
The Members API functionality allows you to perform various operations related to managing members in your organization, such as retrieving a list of all members in your organization, sending invitations to new members, deactivating a member, etc.
The Workspace API endpoints offer a range of functions, including creating, updating, listing, and deleting workspace. When used in conjunction with the Grant endpoint, these endpoints can be particularly useful for setting up Role-Based Access Control (RBAC) on the Sigma Platform.
These endpoints can be utilized for several purposes, such as creating a tag, retrieving a list of tags, and tagging a specific version of a workbook. By tagging a version, you can easily refer to it in the future. One of the primary use cases for these endpoints is to develop a workbook and then move it from a lower environment to a higher one.
How to get started with Sigma Computing API?
Getting started with the Sigma computing API is easy. First, you'll need to sign up for a Sigma Computing account. Once you've created your account, you can access the API documentation, which provides detailed instructions on how to use the API.
To use the API, you'll need to authenticate using a Client ID/API Token. You can generate a Client ID/API Token in your Sigma Computing admin settings. Once you have it, you can start making API requests using your preferred programming language or framework.
Steps to Create an API Token and Client ID
1. Open your Sigma Admin Portal.
2. Click API & Embed Secrets to open the API & Embed Secrets page located on the left side of the page.
3. On the 'API & Embed Secrets' page, click Create New button.
4. The Create New API Token or Embed Secret modal will open (By default, the API Token option will be selected)
5. We need to Enter a Name to identify the specific API Token.
6. Enter a description [optional]
7. Under Owner, you need to select the user account you would like to associate with the token. Note: Account type permissions that are assigned to the selected Sigma user will automatically be carried over to the Sigma API Token.
8. Click Create.
9. An API Token model will appear. Click on Copy and immediately paste the secret in a secure location.
Important: Once this model is closed, the secret cannot be retrieved.
10. Click Close.
The APIs & Embed Secrets panel will show the newly created Sigma API Token.
Now Hover over the token's Client ID and click on copy.
Making Calls to API Endpoints
After obtaining these values, you can begin to call the API endpoints mentioned earlier as needed. To illustrate, let's consider the process of configuring a connection, team, and workspace on the Sigma Platform using Python.
1. Create a .env file, and both client_id and client_secret, which we generated above, are pasted into a .env file.
This will allow access to Sigma Endpoints, and in return, we will receive an access token which we will use to create Objects such as Connection, Teams, Workspace, etc.
2. Create one JSON file to store the Variables required to create Connections, Team, and Workspace, such as user, role, account, warehouse, etc.
3. Get Access Token using endpoint POST /v2/auth/token.
4. Create a Connection using endpoint POST /v2/connections.
5. Create a Team using endpoint POST /v2/teams.
6. Create a Workspace using endpoint POST /v2/workspaces.
Once the Python code above runs successfully, you will have established a connection between Sigma and your preferred data warehouses, such as Snowflake or Redshift, as well as created a team and workspace.
Sigma's computing API provides developers with a comprehensive suite of endpoints to create, update, and delete various entities such as connections, teams, workbooks, datasets, members, and workspaces. With the API, developers can perform a wide range of operations, including validating data warehouse connections, creating new workbooks, initiating dataset materializations, and downloading query results. Additionally, the API provides access to Sigma's visualization engine. The supported API endpoints provide developers with the flexibility and scalability they need to build sophisticated data-driven applications. If you're looking for a way to take your data analysis and visualization to the next level, the Sigma computing API is definitely worth exploring.