Skip to main content

api_integrations

Creates, updates, deletes, gets or lists an api_integrations resource.

Overview

Nameapi_integrations
TypeResource
Idsnowflake.api_integration.api_integrations

Fields

The following fields are returned by SELECT queries:

A Snowflake API integration object.

NameDatatypeDescription
namestringName of the API integration. (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$)
api_allowed_prefixesarrayA comma-separated list of endpoints and resources that Snowflake can access.
api_blocked_prefixesarrayA comma-separated list of endpoints and resources that are not allowed to be called from Snowflake.
api_hookobject
commentstringComment for the API integration.
created_onstring (date-time)Date and time when the API integration was created.
enabledbooleanWhether the API integration is enabled.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_api_integrationsselectendpointlikeList API integrations
fetch_api_integrationselectname, endpointFetch an API integration
create_api_integrationinsertendpointcreateModeCreate an API integration
create_or_alter_api_integrationreplacename, endpointCreate an (or alter an existing) API integration. Note that API_KEY is not currently altered by this operation and is supported for a newly-created object only. Unsetting API_BLOCKED_PREFIXES is also unsupported.
delete_api_integrationdeletename, endpointifExistsDelete an API integration

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
endpointstringOrganization and Account Name (default: orgid-acctid)
namestringIdentifier (i.e. name) for the resource.
createModestringQuery parameter allowing support for different modes of resource creation. Possible values include: - errorIfExists: Throws an error if you try to create a resource that already exists. - orReplace: Automatically replaces the existing resource with the current one. - ifNotExists: Creates a new resource when an alter is requested for a non-existent resource.
ifExistsbooleanQuery parameter that specifies how to handle the request for a resource that does not exist: - true: The endpoint does not throw an error if the resource does not exist. It returns a 200 success response, but does not take any action on the resource. - false: The endpoint throws an error if the resource doesn't exist.
likestringQuery parameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters.

SELECT examples

List API integrations

SELECT
name,
api_allowed_prefixes,
api_blocked_prefixes,
api_hook,
comment,
created_on,
enabled
FROM snowflake.api_integration.api_integrations
WHERE endpoint = '{{ endpoint }}' -- required
AND like = '{{ like }}';

INSERT examples

Create an API integration

INSERT INTO snowflake.api_integration.api_integrations (
data__name,
data__api_hook,
data__api_allowed_prefixes,
data__api_blocked_prefixes,
data__enabled,
data__comment,
endpoint,
createMode
)
SELECT
'{{ name }}' --required,
'{{ api_hook }}' --required,
'{{ api_allowed_prefixes }}' --required,
'{{ api_blocked_prefixes }}',
{{ enabled }} --required,
'{{ comment }}',
'{{ endpoint }}',
'{{ createMode }}'
;

REPLACE examples

Create an (or alter an existing) API integration. Note that API_KEY is not currently altered by this operation and is supported for a newly-created object only. Unsetting API_BLOCKED_PREFIXES is also unsupported.

REPLACE snowflake.api_integration.api_integrations
SET
data__name = '{{ name }}',
data__api_hook = '{{ api_hook }}',
data__api_allowed_prefixes = '{{ api_allowed_prefixes }}',
data__api_blocked_prefixes = '{{ api_blocked_prefixes }}',
data__enabled = {{ enabled }},
data__comment = '{{ comment }}'
WHERE
name = '{{ name }}' --required
AND endpoint = '{{ endpoint }}' --required
AND data__name = '{{ name }}' --required
AND data__api_hook = '{{ api_hook }}' --required
AND data__api_allowed_prefixes = '{{ api_allowed_prefixes }}' --required
AND data__enabled = {{ enabled }} --required;

DELETE examples

Delete an API integration

DELETE FROM snowflake.api_integration.api_integrations
WHERE name = '{{ name }}' --required
AND endpoint = '{{ endpoint }}' --required
AND ifExists = '{{ ifExists }}';