Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
ALERT: The support homepage carousel is not displaying. We are working toward a resolution.

How to connect to Snowflake using an API call and Key Pair Authentication with Qlik Sense Enterprise on Windows

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Joseph_Musekura
Support
Support

How to connect to Snowflake using an API call and Key Pair Authentication with Qlik Sense Enterprise on Windows

Last Update:

Jul 1, 2025 2:03:17 AM

Updated By:

Sonja_Bauernfeind

Created date:

Jul 1, 2025 2:03:17 AM

The information in this article is provided as-is and will be used at your discretion. Depending on the tool(s) used, customization(s), and/or other factors, ongoing support on the solution below may not be provided by Qlik Support. For assistance, engage with our active Connectivity and Data Prep forums.

This article outlines an approach to connect Snowflake using API calls and Key Pair Authentication to Qlik Sense Enterprise on Windows.

Generate the information required to make a POST call

To begin, you will need to obtain the connection details in JSON format. The three steps outlined here are a possible way to do so; you may have different methods available to you. 

  1. Use the Qlik Data Editor to create a new Snowflake connection with the Key Pair Authentication Mechanism:

    create snowflake connection.png

  2. Collect the {id} of the new connection from the Qlik Sense Management Console (QMC)

    get ID.png

  3. Make a GET call to obtain the connection details in JSON format:
    get /dataconnection/{id}
    For more information, read get /dataconnection/{id}.

    For example, the following PowerShell will query the repository with details obtained in step three. We use the user ”internal\sa_repository”.

    # Ignore SSL validation errors
    add-type @"
    using System.Net;
    using System.Security.Cryptography.X509Certificates;
    public class TrustAllCertsPolicy : ICertificatePolicy {
       public bool CheckValidationResult(
           ServicePoint srvPoint, X509Certificate certificate,
           WebRequest request, int certificateProblem) {
           return true;
       }
    }
    "@
    [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
    # Force TLS 1.2
    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    # Headers and cert
    $hdrs = @{
       "X-Qlik-xrfkey" = "12345678qwertyui"
       "X-Qlik-User" = "UserDirectory=internal;UserId=sa_repository"
    }
    $cert = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where-Object { $_.Subject -like '*QlikClient*' }
    if (-not $cert) {
       Write-Error "Qlik client certificate not found!"
       exit
    }
    # API URL
    $url = "https://qlikserver1.domain.local:4242/qrs/dataconnection/400af54c-9913-4e49-90fb-d6e9fecbe3f6?xrfkey=12345678qwertyui"
    # Make request 
    $resp = Invoke-RestMethod -Uri $url -Method Get -Headers $hdrs -Certificate $cert
    $resp | ConvertTo-Json -Depth 10
    The JSON result from the above GET will look like this:
    {
    	  "id":  "400af54c-9913-4e49-90fb-d6e9fecbe3f6",
        "createdDate":  "2025-06-13T13:29:39.611Z",
        "modifiedDate":  "2025-06-13T13:29:39.611Z",
        "modifiedByUserName":  "DOMAIN\\qvservice",
        "customProperties":  [],
     	  "owner":  {
             "id":  "874751d5-61f2-411a-bba2-147c68581471",
             "userId":  "qvservice",
             "userDirectory":  "DOMAIN",
             "userDirectoryConnectorName": "",
             "name":  "qvservice",
             "privileges":  null
         },
    "name": "Snowflake_no_encrypted (domain_qvservice)",
    "connectionstring": ""CUSTOM CONNECT TO \"provider=QvOdbcConnectorPackage.exe;driver=snowflake;server=JIPCXQB-ATTUNITY_PARTNER.snowflakecomputing.com;po
    rt=443;database=testDATABASE;schema=PUBLIC;warehouse=MONO_TEST;validateSessionParam=false;role=SYSADMIN;authenticator=snowflake_jwt;allowNonSelectQueries=fa
    lse;QueryTimeout=600;useBulkReader=true;maxStringLength=4096;\"",
    "type": "QvOdbcConnectorPackage.exe",
    "engineObjectId": "",
    "username": "jmkxxxx",
    "password": "PRIV_KEY_FILE%2rsa_key.p8%%2LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0.........",  //see note bellow
    "architecture": 0,
    "privileges":  null,
    "schemaPath":  "DataConnection"
    }

Make a POST call using the JSON

  1. Make a POST call with the details now in JSON format:
    Post /dataconnection
    For more information, read post /dataconnection.

  2. The related POST call using PowerShell scripts will look like:

    {
        "id":  "400af54c-9913-4e49-90fb-d6e9fecbe3f6",
        "createdDate":  "2025-06-13T13:29:39.611Z",
        "modifiedDate":  "2025-06-13T13:29:39.611Z",
        "modifiedByUserName":  "DOMAIN\\qvservice",
        "customProperties":  [
    
                             ],
        "owner":  {
                      "id":  "874751d5-61f2-411a-bba2-147c68581471",
                      "userId":  "qvservice",
                      "userDirectory":  "DOMAIN",
                      "userDirectoryConnectorName":  "",
                      "name":  "qvservice",
                      "privileges":  null
                  },
        "name":  "Snowflake_no_encrypted (domain_qvservice)",
        "connectionstring":  "CUSTOM CONNECT TO \"provider=QvOdbcConnectorPackage.exe;driver=snowflake;server=JIPCXQB-ATTUNITY_PARTNER.snowflakecomputing.com;po
    rt=443;database=testDATABASE;schema=PUBLIC;warehouse=MONO_TEST;validateSessionParam=false;role=SYSADMIN;authenticator=snowflake_jwt;allowNonSelectQueries=fa
    lse;QueryTimeout=600;useBulkReader=true;maxStringLength=4096;\"",
        "type":  "QvOdbcConnectorPackage.exe",
        "engineObjectId":  "400af54c-9913-4e49-90fb-d6e9fecbe3f6",
        "username":  "jmxxxxx ",
    	   "password": "PRIV_KEY_FILE%2rsa_key.p8%%2LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0xxxxxxxxxxxxxxx..",
        "logOn":  1,
        "architecture":  0,
        "tags":  [
    
                 ],
        "privileges":  null,
        "schemaPath":  "DataConnection"
    }

Related Content

How to create a Qlik Oracle Wallet ODBC connection via the QRS Rest API 

 

 

Environment

  • Qlik Sense Enterprise on Windows
Labels (1)
Version history
Last update:
‎2025-07-01 02:03 AM
Updated by: