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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
thomasmaure
Partner - Contributor III
Partner - Contributor III

Need an example for snowflake data connection via API and key-pair authentication

Hello , 

I am trying to create via REST API a data connection to snowflake with Key-pair authentication. 
however I am struggling with the "PRIV_KEY_FILE" property . 
I am using 
https://qlik.dev/apis/rest/data-connections/#post-v1-data-connections 
with qlik cli 
qlik raw post --body <body>

Where <body> = 

{
"connectionProperties": {
"allowNonSelectQueries": false,
"authenticator": "snowflake_jwt",
"database": "***********_PDT",
"port": "443",
"PRIV_KEY_FILE": [ { "SNOWFLAKE_PDT.p8": "LS**********LS0K" }],
"role": "QLIK_*********_TST_R",
"schema": "PDT",
"server": "********.west-europe.azure.snowflakecomputing.com",
"useBulkReader": true,
"username": "ROBOTIC_*********_tst_cd_01_tst",
"warehouse": "WAREHOUSE_************_PDT_XS"
},
"dataSourceId": "snowflake",
"qName": "SNOWFLAKE_PDT",
"space": "67c86133d40d37802a29fac4"
}



The error returned is : 

   {
      "code": "DCERROR-0071",
      "title": "Other external dependency request error",
      "status": 424,
      "detail": "dcaas API call 'POST /v1/data-sources/actions/generate-connection-string' failed with code: 400",
      "meta": [
        {
          "code": "DCAAS-2004",
          "title": "Unsuccessful command execution",
          "status": 400,
          "detail": "",
          "meta": {
            "description": "Command 'testConnection' exection was not successful",
            "detail": "ERROR [28000] [Qlik][DSI] (20032) Required setting 'PRIV_KEY_FILE' is not present in the connection settings.",
            "message": "Error message:\r\nPlease check the values for Username‚ Password‚ Host and other properties. Description: Access credentials are not valid for this connection."
          }
        }
      ]
    }
  ],
  "traceId": "d0009b14956e0060cdc6f3263f65f4e6"
}


So I imagine the format for the PRIV_KEY_FILE property is not correct but I cannot find any example in the doc.

Could someone please help me with this parameter by providing me the correct syntax ? 

Thanks 

Thomas 


Labels (3)
1 Solution

Accepted Solutions
thomasmaure
Partner - Contributor III
Partner - Contributor III
Author

Ok, so I changed a little bit the query and this appears to work 🙂 

{
    "connectionProperties": {
        "allowNonSelectQueries": false,
        "authenticator": "snowflake_jwt",
        "database": "***********_PDT",
        "port": "443",
        "PRIV_KEY_FILE": [
            {
                "name" : "SNOWFLAKE_PDT.p8", 
				"value": "LS**********LS0K"
            }
        ],
        "role": "QLIK_*********_TST_R",
        "schema": "PDT",
        "server": "********.west-europe.azure.snowflakecomputing.com",
        "useBulkReader": true,
        "username": "ROBOTIC_*********_tst_cd_01_tst",
        "warehouse": "WAREHOUSE_************_PDT_XS"
    },
    "dataSourceId": "snowflake",
    "qName": "SNOWFLAKE_PDT",
    "space": "67c86133d40d37802a29fac4"
}

View solution in original post

1 Reply
thomasmaure
Partner - Contributor III
Partner - Contributor III
Author

Ok, so I changed a little bit the query and this appears to work 🙂 

{
    "connectionProperties": {
        "allowNonSelectQueries": false,
        "authenticator": "snowflake_jwt",
        "database": "***********_PDT",
        "port": "443",
        "PRIV_KEY_FILE": [
            {
                "name" : "SNOWFLAKE_PDT.p8", 
				"value": "LS**********LS0K"
            }
        ],
        "role": "QLIK_*********_TST_R",
        "schema": "PDT",
        "server": "********.west-europe.azure.snowflakecomputing.com",
        "useBulkReader": true,
        "username": "ROBOTIC_*********_tst_cd_01_tst",
        "warehouse": "WAREHOUSE_************_PDT_XS"
    },
    "dataSourceId": "snowflake",
    "qName": "SNOWFLAKE_PDT",
    "space": "67c86133d40d37802a29fac4"
}