Diagram showing how to generate a snowflake REST API

Why Generate a Snowflake REST API?

Do you have a ton of data sources and do not know how to expose them? Do you know you need a Snowflake API but don’t know where to begin to build it? Look no further, DreamFactory can take any database and generate a fully documented and secure REST API faster than making a sandwich. All you need is your Snowflake credentials and DreamFactory will handle the rest, instantly generating OpenAPI documentation and securing your API by way of API keys. Follow along with the blog!

DreamFactory Hosted Trial Signup

Generate a full-featured, documented, and secure REST API in minutes.

Sign up for our free 14 day hosted trial to learn how.

Snowflake REST API Examples

Snowflake is a cloud-based data warehousing platform that provides various REST APIs to facilitate the integration, management, and access to Snowflake’s resources. Some examples of Snowflake REST APIs include:

  1. Account Usage API: Helps in retrieving account-level usage data, like credits used, storage metrics, and other billing-related information.
  2. Role Management API: Enables the creation, updating, and deletion of roles in Snowflake, as well as assigning users to specific roles.
  3. Virtual Warehouses API: Controls the provisioning and scaling of compute resources (virtual warehouses) within Snowflake, allowing for the starting, stopping, resizing, and monitoring of these resources.
  4. OAuth Token Management API: Supports OAuth-based authentication by allowing the management of OAuth tokens, including creation, refresh, and revocation.
  5. User Management API: Facilitates the management of users within Snowflake, including the creation, updating, deletion, and listing of users, as well as setting user preferences.
  6. Database Migration API: Enables the migration of databases from other platforms to Snowflake by providing endpoints to manage and monitor the migration process.
  7. Health Monitoring API: Offers endpoints to monitor the health and performance of the Snowflake service, including current status, historical data, and any incidents or issues.
  8. Storage Integration API: Helps in managing external storage integrations for accessing data outside of Snowflake, such as in AWS S3, Azure Blob Storage, or Google Cloud Storage.

These APIs allow you to interact with different features within Snowflake using code. This makes it easier to automate tasks, connect with other software, and manage and use Snowflake’s data storage services more efficiently.

Generating A Snowflake API

In order to generate a snowflake API, we’ll have to install DreamFactory.

Installing DreamFactory

In order to get started, you must install DreamFactory, which is Open Source and gives you the ability to try out several popular databases. To spin up your own hosted environment for free click here.

Now the fun part. Once you have DreamFactory up and running you will be on the Admin panel. From there you will navigate to the Services tab to connect your database to your API. In the below example, I have selected Big Data to get to the Snowflake connector. This is nearly identical for any database you want to connect to. Connecting your database typically only requires filling out these fields as shown below.

snowflake1

Upon saving there will be a success window pop-up saying “Service saved successfully”. What it doesn’t tell you is all the magic it just did behind the scenes. In just that short amount of time, it generated your Snowflake REST API. You now navigate to the API Docs tab and you can see your new OpenAPI documentation for the API and actually interact with it via the “Try it out” button.

Screen Shot 2021-01-25 at 2.12.56 PM

Securing and Interacting with the Snowflake API

I can end it here now that you have generated your API, but where is the fun in that? Now let’s actually see the API in action! First things first, let’s generate an API key to be paired with the API for security purposes. DreamFactory does not allow access to the API without being authenticated. Let’s navigate to the Roles tab and create a Role for our API. This Role with correspond with the API key so different users can have different privileges based off different keys.

Screen Shot 2021-01-25 at 2.10.44 PM

For my Role I have pointed it to the Snowflake REST API Service we just created and told it to only allow GET calls on the endpoints. This will ensure anyone using this API key will not be able to, for example delete data from the database.

We must now link this Role to an API key. If we now go to the Apps tab we can create a new API key with the corresponding Role.

Screen Shot 2021-01-25 at 2.16.20 PM

Once we hit save we are able to see the API key generated for our use. Just to show how it works I will be using Insomnia, a popular HTTP service, to call our DreamFactory API. I will call the customers table, passing the API key in the headers for authentication.

Screen Shot 2021-01-25 at 2.20.24 PM
DreamFactory Hosted Trial Signup

Generate a full-featured, documented, and secure REST API in minutes.

Sign up for our free 14 day hosted trial to learn how.

Conclusion

As you can see I have access to our new API and how much time did that take? Way less time than building this API yourself! If you would like to find out exactly how much time and money DreamFactory can save you, check out our API calculator. Otherwise what are you waiting for? Go build your next application using DreamFactory already!

If you have any questions about the platform, or just APIs in general, we’d love to hear from you! Contact us.

Related reading: What is Snowflake? Features, Pros and Cons, and Reviews