Documentation

Add a Database to Account

It is possible to add database data sources by using a SSO API. Please be aware, that the user of the token must be an admin.

 

Below you find a token payload example:
 

{

"iss": "org",

"aud": "",

"jti": "9xSRwHnWjyAAo06_iHlxbw",

"iat": 1611828320,

"sub": "admin@customer.com",

"userType": "ADMIN"

}

 
URL:
 

https://datapine.com/organization/{organization_id}/datasource?token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJvcmciLCJhdWQiOiIiLCJqdGkiOiI5eFNSd0huV2p5QUFvMDZfaUhseGJ3IiwiaWF0IjoxNjExODI4MzIwLCJzdWIiOiJhZG1pbkBjdXN0b21lci5jb20iLCJ1c2VyVHlwZSI6IkFETUlOIn0.rLbAzqQ_eonMr05bYfWJ25AN8dXrG1GgvRurArKJAJc

 

Method: POST
Request parameters: token
Request Body:
 

{

"host": "customer.database.host.com",

"database": "example",

"user": "db_user",

"password": "XXX",

"urlConfig": "",

"name":"multi 14",

"port": 1433,

"type": "sqlserver",

"sid": "",

"ssh": false,

"sshWithKey": true,

"sshHost": null,

"remoteSshPort": 0,

"sshUser": "",

"sshPassword": "",

"sessionVariables":{

"organization_id":14

}

}

 
Request Response:
 

{
  "host": "customer.database.host.com",
  "database": "example",
  "user": "db_user",
  "password": "XXX",
  "urlConfig": "",
  "name":"multi 14",
  "port": 1433,
  "type": "sqlserver",
  "sid": "",
  "ssh": false,
  "sshWithKey": true,
  "sshHost": null,
  "remoteSshPort": 0,
  "sshUser": "",
  "sshPassword": "",
  "sessionVariables":{
    "organization_id":14
  }
}

 
The parameters are equivalent to the connection screen:
 
database connection screen datapine
 
host: host or IP for database

database: database name

user: database user

password: database password

urlConfig: additional JDBC parameters

name: internal data source name

port: database port

type: database type in case or oracle

sid: sid in case or oracle

ssh: flag to enable SSH (true/false)

sshWithKey: flag to SSH access by key (true/false)

sshHost: SSH host or IP

remoteSshPort: SSH port

sshUser: SSH user

sshPassword: SSH password

sessionVariables: for Azure or Microsoft SQL Server 2016 or higher, these variables can be used in multi-tenant environments to set a session context: https://docs.microsoft.com/en-us/sql/t-sql/functions/session-context-transact-sql.

 

datapine supports these database types by default: MySQL, MySQL8, MariaDB, Azure, Aurora, RedShift, SQL Server, PostgreSQL, Oracle.

 

Please contact us, if you want to connect another database type.