A Data Source object has the following properties:
id
: string - The unique identifier of a data sourcealias
: string - The unique alias of a data sourceCreates a new data source.
POST /api/v2/data-source
Arguments:
name
- string : The name of the new data sourcealias
- string : The alias of the new data source (optional)configUri
- string : The connection URI of the data sourceResponse object:
id
- string : The unique identifier of the data sourcename
- string : The name of the data sourcealias
- string : The unique alias of the data sourcetype
- string : The data source typeconfigUri
- string : The connection URI of the data sourcecreatedAt
- timestamp : When the data source was createdupdatedAt
- timestamp : When the data source was last updatedExample request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
-X POST \
"${JACKDB_API_URL}/data-source" \
-d name=SomeDB&alias=some-db&configUri=postgresql://someuser:t0ps3cret@somedb.example.com:5432/some-db"
Example response:
{
"id": "DKgU62P1dUlJfGTG",
"name": "SomeDB",
"alias": "some-db",
"type": "postgresql",
"configUri": "postgresql://someuser:t0ps3cret@somedb.example.com:5432/some-db?validateSsl=false&ssl=true",
"createdAt": "2015-03-12T20:25:00.760Z",
"updatedAt": "2015-03-12T20:25:00.760Z"
}
Permanently deletes an existing data source.
DELETE /api/v2/data-source/:data-source
Arguments:
Response object:
This method returns an object with no properties.
Example request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
-X DELETE \
"${JACKDB_API_URL}/data-source/DUGC6IqGQ4DX00Lt0"
Example response:
{}
Permanently deletes all permissions granted on a data source.
DELETE /api/v2/data-source/:data-source/permission
Arguments:
Response object:
count
- integer : the number of deleted permissionsExample request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
-X DELETE \
"${JACKDB_API_URL}/data-source/DUGC6IqGQ4DX00Lt0/permission"
Example response:
{
"count": 3
}
Executes commands on an existing data source.
POST /api/v2/data-source/:data-source/execute
Available in JackDB Enterprise v6.0+
Arguments:
Response object:
queryId
- string : The unique identifier of the newly created API query objectExample request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
-X POST \
"${JACKDB_API_URL}/data-source/DUGC6IqGQ4DX00Lt0/test" \
-H "Content-Type: application/json" \
-d '{
"commandTexts": [
"SELECT 1 AS a",
"SELECT x FROM generate_series(1, 10) x"
]
}'
Example response:
{
"queryId": "4f3da13d-df82-4328-b4ba-42d08cb28f53"
}
The list of commands will be executed in a single transaction, one after the other. Any result sets or outputs from each command will be aggregated before proceeding to the next command. If an error occurs, the entire transaction is rolled back.
Returns a list of all permissions granted on a data source.
GET /api/v2/data-source/:data-source/permission
Arguments:
Response object:
id
- string : The unique identifier of the permissionpersonId
- string : The unique identifier of the person to whom this permission is granteddataSourceId
- string : The unique identifier of the data source onto which this permission is grantedstartsAt
- timestamp : When this permission is set to startexpiresAt
- timestamp : When this permission is set to expireExample request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
"${JACKDB_API_URL}/data-source/DUGC6IqGQ4DX00Lt0/permission"
Example response:
[
{
"id": "68939",
"personId": "P0cKFCMIHoNaBFt7Y",
"dataSourceId": "DUGC6IqGQ4DX00Lt0",
"startsAt": "2015-03-12T23:47:14.120Z",
"expiresAt": "2015-03-13T00:47:14.120Z"
},
{
"id": "69303",
"personId": "P0cKFCMIHoNaBFt7Y",
"dataSourceId": "DUGC6IqGQ4DX00Lt0",
"startsAt": "2015-03-12T23:47:14.120Z",
"expiresAt": "2015-03-13T00:47:15.193Z"
},
{
"id": "69603",
"personId": "P3Fz69ORRudnQo5LE",
"dataSourceId": "DUGC6IqGQ4DX00Lt0",
"startsAt": "2015-03-12T23:47:14.120Z",
"expiresAt": "2015-03-13T00:47:15.832Z"
}
]
Returns a list of all roles containing a data source.
GET /api/v2/data-source/:data-source/role
Arguments:
Response object:
id
- string : The unique identifier of the rolename
- string : The name of the roleassignedAt
- timestamp : When the data source was assigned to the roleExample request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
"${JACKDB_API_URL}/data-source/DUGC6IqGQ4DX00Lt0/role"
Example response:
[
{
"id": "RKm2x3dfX0b505iHy",
"name": "HR",
"assignedAt": "2014-07-27T15:01:59.901Z",
},
{
"id": "RC98On0Dus9ZrskYH",
"name": "Finance",
"assignedAt": "2014-07-31T18:09:58.637Z",
}
]
Returns a list of all data sources.
GET /api/v2/data-source
Arguments:
This method has no additional arguments.
Response object:
id
- string : The unique identifier of the data sourcename
- string : The name of the data sourcealias
- string : The unique alias of the data sourcetype
- string : The data source typeconfigUri
- string : The connection URI of the data sourcecreatedAt
- timestamp : When the data source was createdupdatedAt
- timestamp : When the data source was last updatedExample request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
"${JACKDB_API_URL}/data-source"
Example response:
[
{
"id": "DUGC6IqGQ4DX00Lt0",
"name": "General Ledger",
"alias": "gl-prod",
"type": "postgresql",
"configUri": "postgresql://gl@db.example.com:5432/gl",
"createdAt": "2014-08-05T22:05:15.987Z",
"updatedAt": "2014-09-04T18:23:32.777Z"
},
{
"id": "DBnkfabo6VtpTaI7f",
"name": "Stuff - Read Only",
"alias": null,
"type": "mysql",
"configUri": "mysql://read_only@mydb.example.com:3306/stuff",
"createdAt": "2014-08-29T19:55:42.666Z",
"updatedAt": "2014-09-04T18:23:32.777Z"
}
]
Note: The connection URI returned by this endpoint does not contain the password of the underlying database; only the database user, hostname, and port number are included.
Retrieves the basic details of an existing data source.
GET /api/v2/data-source/:data-source
Arguments:
Response object:
id
- string : The unique identifier of the data sourcename
- string : The name of the data sourcealias
- string : The unique alias of the data sourcetype
- string : The data source typeconfigUri
- string : The connection URI of the data sourcecreatedAt
- timestamp : When the data source was createdupdatedAt
- timestamp : When the data source was last updatedExample request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
"${JACKDB_API_URL}/data-source/DUGC6IqGQ4DX00Lt0"
Example response:
{
"id": "DUGC6IqGQ4DX00Lt0",
"name": "General Ledger",
"alias": "gl-prod",
"type": "postgresql",
"configUri": "postgresql://gl@db.example.com:5432/gl",
"createdAt": "2014-08-05T22:05:15.987Z",
"updatedAt": "2014-09-04T18:23:32.777Z"
}
Note: The connection URI returned by this endpoint does not contain the password of the underlying database; only the database user, hostname, and port number are included.
Retrieves the details of an existing data source.
GET /api/v2/data-source/:data-source/detail
Arguments:
Response object:
id
- string : The unique identifier of the data sourcename
- string : The name of the data sourcealias
- string : The unique alias of the data sourcetype
- string : The data source typeconfigUri
- string : The connection URI of the data sourcecreatedAt
- timestamp : When the data source was createdupdatedAt
- timestamp : When the data source was last updatedExample request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
"${JACKDB_API_URL}/data-source/DUGC6IqGQ4DX00Lt0/detail"
Example response:
{
"id": "DUGC6IqGQ4DX00Lt0",
"name": "General Ledger",
"alias": "gl-prod",
"type": "postgresql",
"configUri": "postgresql://gl:t0ps3cret@db.example.com:5432/gl",
"createdAt": "2014-08-05T22:05:15.987Z",
"updatedAt": "2014-09-04T18:23:32.777Z"
}
Note: The connection URI returned by this endpoint contains the password of the underlying database.
Test connecting to an existing data source.
POST /api/v2/data-source/:data-source/test
Arguments:
Response object:
If the connection attempt is successful, the endpoint returns an object with the following properties:
success
- boolean : Whether a connection to the data source could be established. (will be true for success responses)version
- object : The server version of the data source. This is provided for informational purposes and the exact format of this object may change in a future release. Currently it returns the major/minor/patch version of the remote database server as well as a text description of the server software and version.If the connection attempt is not successful, the endpoint returns an object with the following properties:
success
- boolean : Whether a connection to the data source could be established. (will be false for unsuccessful responses)message
- string : A description of the error encountered connecting to the data source.Example request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
-X POST \
"${JACKDB_API_URL}/data-source/DUGC6IqGQ4DX00Lt0/test"
Example responses:
{
"success": true,
"version": {
"productName": "PostgreSQL",
"productVersion": "9.6.2",
"major": 9,
"minor": 6,
"patch": 2
}
}
{
"success": false,
"message": "The connection timed out while trying to establish a connection. Please check that your data source is online and the proper firewall configuration has been setup."
}
Updates an existing data source.
POST /api/v2/data-source/:data-source
Arguments:
Response object:
id
- string : The unique identifier of the data sourcename
- string : The name of the data sourcealias
- string : The unique alias of the data sourcetype
- string : The data source typeconfigUri
- string : The connection URI of the data sourcecreatedAt
- timestamp : When the data source was createdupdatedAt
- timestamp : When the data source was last updatedExample request:
$ curl \
-H "Accept: application/vnd.jackdb.v2+json" \
-u "${JACKDB_API_KEY_ID}@api:${JACKDB_API_KEY_SECRET}" \
-X POST \
"${JACKDB_API_URL}/data-source/DKgU62P1dUlJfGTG" \
-d name=SomeDB&alias=some-db&configUri=postgresql://someuser:t0ps3cret@somedb.example.com:5432/some-db"
Example response:
{
"id": "DKgU62P1dUlJfGTG",
"name": "SomeDB",
"alias": "some-db",
"type": "postgresql",
"configUri": "postgresql://someuser:t0ps3cret@somedb.example.com:5432/some-db?validateSsl=false&ssl=true",
"createdAt": "2015-03-12T20:25:00.760Z",
"updatedAt": "2015-03-12T20:25:00.760Z"
}