Create data connections

Example creation requests

These examples demonstrate how to create analytics data connections. To learn more, review create data connections.

AWS S3 connection

File connection (S3 v2)

Creates a file connection to a bucket named bucket-name.

curl -L 'https://<TENANT>/api/v1/dcaas/actions/data-connections' ^
-H 'Content-Type: application/json' ^
-H 'Authorization: Bearer <ACCESS_TOKEN>' ^
-d '{
    "dataSourceId": "File_AmazonS3ConnectorV2",
    "connectionName": "<CONNECTION_NAME>",
    "spaceId": "<SPACE_ID>",
    "connectionProperties": {
        "accessKey": "<CRED_USERNAME>",
        "secretKey": "<CRED_PASSWORD>",
        "region": "us-east-1",
        "bucketName": "bucket-name"
    }
}'
Metadata connection (S3 v2)

Creates a metadata connection to a bucket named bucket-name.

curl -L 'https://<TENANT>/api/v1/dcaas/actions/data-connections' ^
-H 'Content-Type: application/json' ^
-H 'Authorization: Bearer <ACCESS_TOKEN>' ^
-d '{
    "dataSourceId": "AmazonS3ConnectorV2",
    "connectionName": "<CONNECTION_NAME>",
    "spaceId": "<SPACE_ID>",
    "connectionProperties": {
        "accessKey": "<CRED_USERNAME>",
        "secretKey": "<CRED_PASSWORD>",
        "region": "us-east-1",
        "bucketName": "bucket-name"
    }
}'

Google Cloud Storage connection

File connection

Creates a file connection to a bucket named bucket-name.

curl -L 'https://<TENANT>/api/v1/dcaas/actions/data-connections' ^
-H 'Content-Type: application/json' ^
-H 'Authorization: Bearer <ACCESS_TOKEN>' ^
-d '{
    "dataSourceId": "File_GoogleCloudStorageConnector",
    "connectionName": "<CONNECTION_NAME>",
    "spaceId": "<SPACE_ID>",
    "connectionProperties": {
        "serviceAccountKeyFile": 
            [
                {
                    "name": "mykeyfile.json",
                    "value": "<CRED_CERTIFICATE>"
                }
            ],
        "bucketName": "bucket-name"
    }
}'
Metadata connection

Creates a metadata connection to a bucket named bucket-name.

curl -L 'https://<TENANT>/api/v1/dcaas/actions/data-connections' ^
-H 'Content-Type: application/json' ^
-H 'Authorization: Bearer <ACCESS_TOKEN>' ^
-d '{
    "dataSourceId": "GoogleCloudStorageConnector",
    "connectionName": "<CONNECTION_NAME>",
    "spaceId": "<SPACE_ID>",
    "connectionProperties": {
        "serviceAccountKeyFile": 
            [
                {
                    "name": "mykeyfile.json",
                    "value": "<CRED_CERTIFICATE>"
                }
            ],
        "bucketName": "bucket-name"
    }
}'

REST connection

Qlik Cloud with encrypted header auth

This example connects to the users endpoint on the current tenant, and applies some endpoint specific limits and sorting. It also allows the withConnection statement which is required for dynamic control of the connection from application load scripts.

When connecting to Qlik Cloud, a header is used for authorization. In this example, you are connecting to the same tenant in which you're creating the data connection, so you can use the same <ACCESS_TOKEN> for both the dcaas and users APIs. The Authorization header is encrypted using the encrypt attribute.

curl -L 'https://<TENANT>/api/v1/dcaas/actions/data-connections' ^
-H 'Content-Type: application/json' ^
-H 'Authorization: Bearer <ACCESS_TOKEN>' ^
-d '{
    "dataSourceId": "rest",
    "connectionName": "<CONNECTION_NAME>",
    "spaceId": "<SPACE_ID>",
    "connectionProperties": {
        "url": "https://<TENANT>/api/v1/users",
        "queryParameters": [
            {
                "name": "sort",
                "value": "+name"
            },
            {
                "name": "limit",
                "value": "50"
            }
        ],
        "queryHeaders": [
            {
                "name": "Authorization",
                "value": "Bearer <ACCESS_TOKEN>",
                "encrypt": true
            }
        ],
        "allowWithConnection": "true"
    }
}'

SFTP connection

Public key fingerprint with private key for AWS Transfer Family

This example connects to AWS Transfer Family's SFTP service, on host abs.server.transfer.us-east-1.amazonaws.com. It uses a public key fingerprint alongside the full private key and username for auth.

curl -L 'https://<TENANT>/api/v1/dcaas/actions/data-connections' ^
-H 'Content-Type: application/json' ^
-H 'Authorization: Bearer <ACCESS_TOKEN>' ^
-d '{
    "dataSourceId": "File_FileTransferConnector",
    "connectionName": "<CONNECTION_NAME>",
    "spaceId": "<SPACE_ID>",
    "connectionProperties": {
        "host": "abs.server.transfer.us-east-1.amazonaws.com",
        "sftpPort": "22",
        "publicKeyAlgorithm": "RSA",
        "publicKeyFingerprint": "<CRED_FINGERPRINT>",
        "username": "<CRED_USERNAME>",
        "privateKey": [
            {
                "name": "mykey.pem",
                "value": "<CRED_CERTIFICATE>"
            }
        ]
    }
}'
Was this page helpful?