Common setup for Snowflake REST APIs tutorials

Introduction

This topic provides instructions for the common setup required for all Snowflake REST APIs tutorials available in this documentation.

Overview of the Snowflake REST APIs

Before starting your setup, take a look at the Snowflake REST APIs. The following table lists the available APIs:

API

Description

Compute Pool

Manages Snowflake compute pools.

Cortex Analyst

Sends data questions to Cortex Analyst.

Cortex Inference

Performs LLM text completion inference.

Cortex Search Service

Queries a Cortex Search Service.

Database

Manages Snowflake databases.

Dynamic Table

Manages Snowflake dynamic tables.

Function

Manages Snowflake functions.

Grant

Manages Snowflake grants.

Image Repository

Manages Snowflake image repositories.

Role

Manages Snowflake roles.

Schema

Manages Snowflake schemas.

Service

Manages Snowflake services.

Stage

Manages Snowflake stages.

Table

Manages Snowflake tables.

Task

Manages Snowflake tasks.

User

Manages Snowflake users.

For a complete list of the APIs currently available, see the Snowflake REST APIs reference documentation.

Import the Snowflake REST APIs collections

This tutorial walks you through the process of importing the Snowflake REST APIs collections from Postman.

  1. Download the API collections from the Git repository into a folder.

    ../../../_images/api-collections-git.png
  2. Open the Postman application, and create an account, if necessary.

  3. In Postman, open the desired workspace.

    ../../../_images/postman-workspace.png
  4. Select Import.

    ../../../_images/postman-import-workspace.png
  5. Select folders.

    ../../../_images/postman-download-collections.png
  6. In the dialog, select the folder where you extracted the collection, and select Open.

    ../../../_images/postman-import-elements.png
  7. Verify that all of the items are selected, and select Import.

    You should see the collections listed in the left panel, as shown:

    ../../../_images/postman-verify-import.png

Specify the bearer token in Postman

REST requests require a JWT token in the request header to authenticate the request. In Postman, you can copy the JWT token into the bearerToken header property, as shown.

../../../_images/postman-bearer-token.png

You can then set the x-snowflake-authorization-token-type key to KEYPAIR_JWT in each request header, as shown:

../../../_images/postman-set-header.png

Note

If you prefer writing Python applications, you can use the Snowflake Python APIs to manage Snowflake objects. For more information, see Snowflake Python APIs: Managing Snowflake objects with Python.

Set environment variables in the Postman environment

You can set environment variables in your Postman environment. You can then use these variables in Postman, in the form {{variable_name}}.

All endpoint URLs begin with a baseURL, which identifies your Snowflake account. The baseURL has the form: <account_locator>.snowflakecomputing.com, where <account_locator> is your Snowflake account name.

To set the baseURL variable, as well as any other variables, in Postman, enable each parameter and set its value, as shown:

../../../_images/postman-env-vars.png

For each value you set, you must select Save to save the new value.

What’s next?

Congratulations! In this tutorial, you learned the fundamentals for managing Snowflake database, schema, and table resources using the Snowflake REST APIs.

Summary

Along the way, you completed the following steps:

  • Create and list databases.

  • Create and list schemas.

  • Create a table and fetch the table details.

  • Alter a table and fetch the table details.

  • List available tables.

Next tutorial

You can now proceed to Tutorial 2: Create and manage tasks, which shows you how to create and manage Snowflake tasks.