REST API Connections
- 1 Read Connection
- 1.1 Description
- 1.2 URI syntax
- 1.3 Example response
- 2 Create Connection
- 2.1 Description
- 2.2 URI syntax
- 2.3 Example response
- 2.4 Additional notes
- 2.5 Encryption
- 3 Update Connection
- 3.1 Description
- 3.2 URI syntax
- 3.3 Example response
- 3.4 Additional notes
- 4 Delete Connection
- 4.1 Description
- 4.2 URI syntax
- 4.3 Example response
- 5 List All Connections
- 5.1 Description
- 5.2 URI syntax
- 5.3 Example response
- 6 Connection Dependencies
- 6.1 Description
- 6.2 URI syntax
- 6.3 Example response
- 6.4 Additional notes
- 7 How-tos
For each call, you can add the following command:
-w"\n%{http_code}\n"
After the username and password in order to receive more meaningful HTTP errors.
Read Connection
Request method - GET
Description
Returns information on a specified connector within Datameer including version number, class name, file information (uuid, path, description, name), typeID, and properties information.
URI syntax
curl -u '<username>:<password>' -X GET 'http://<Datameer-serverIP>:<port-number>/rest/connections/<job-configuration-id>'
Example response
{
"version": "2.1",
"className": "datameer.dap.common.entity.DataBaseConnection",
"file": {
"uuid": "23905938-5bd0-42da-afff-f39bd4b11ac0",
"path": "/Data/Connections/MYSQL_QA1.dst",
"description": "MySQL Connection",
"name": "MYSQL_QA1"
},
"typeId": "das.JdbcDataStoreType",
"properties": {
"user_name": [
"extuser"
],
"password": [
"L5lhAwwiuHjl/h08r0pVAg==\r\n"
],
"key.connectionUrl": [
"jdbc:mysql://ec2-23-22-91-33.compute-1.amazonaws.com:3306/world"
],
"dataStoreTemplate": [
"false"
],
"dataStoreUsage": [
"IMPORT_EXPORT"
]
},
"dbType": {
"name": "MySQL"
}
}Create Connection
Request method - POST
Description
Adds a connector in Datameer.
URI syntax
curl -u '<username>:<password>' -X POST -d @<job-payload>.json 'http://<Datameer-serverIP>:<port-number>/rest/connections'
Example response
{
"configuration-id": 8,
"status": "success"
}Additional notes
<job-payload>.json
The payload is a JSON representation of all information entered during the creation process using the web interface.
An easy method of creating a payload is to use REST to read an import job, data link, or workbook and change the JSON that is returned.
Encryption
When creating a connection and the password or SSH key is in plain text within the JSON file, the sensitive data will not be secure while passing from the local host over the network until encrypted by Datameer.
Datameer provides the tool
encrypt.shthat can encrypt sensitive information before it is sent via REST to Datameer.The tool is called
encrypt.shand is located in the bin folder within Datameer.Syntax
encrypt.sh -v <password to encrypt>Example Response
SECURE:0:hnDNk3ZOWZn9bwDiGp7MNuvyEZPHIinQ
This encrypted password or SSH key can then be added to the JSON file used in creating a connection to securely transfer the information.
Update Connection
Request method - PUT
Description
Edits an existing connector in Datameer.
URI syntax
curl -u '<username>:<password>' -X PUT -d @<job-payload>.json 'http://<Datameer-serverIP>:<port-number>/rest/connections/<job-configuration-id>'
Example response
{"status": "success"}Additional notes
<job-payload>.json
The payload is a JSON representation of all information entered during the creation process using the web interface.
An easy method of creating a payload is to use REST to read an import job, data link, or workbook and change the JSON that is returned.
Delete Connection
Request method - DELETE
Description
Removes a connector from Datameer.
URI syntax
curl -u '<username>:<password>' -X DELETE 'http://<Datameer-serverIP>:<port-number>/rest/connections/<job-configuration-id>'
Example response
{"status": "success"}List All Connections
Request method - GET
Description
Returns a list of all the connectors in Datameer. This list displays the description, id number, name, path, and uuid of the connector.
URI syntax
curl -u '<username>:<password>' -X GET 'http://<Datameer-serverIP>:<port-number/rest/connections'
Example response
[
{
"description": "hidden datastore to upload files: FileUploadDataStore",
"id": 1,
"name": "FileUploadDataStore",
"path": "/.system/FileUploadDataStore.dst",
"uuid": "708d54ed-6d73-4de7-b332-f26f5246c972"
}
,{
"description": "A data store for the local filesystem where Datameer is running. Note, this works ONLY for Datameer Personal, Workgroup, and Trial editions.\n",
"id": 2,
"name": "Datameer server filesystem",
"path": "/Data/Connections/Datameer server filesystem.dst",
"uuid": "0eb55632-85e2-404c-85f6-dea1a392dc2c"
}
,{
"description": "Data files for some examples are hosted in Amazon's cloud (S3). Using this data store will download these files into your system and requires internet access",
"id": 3,
"name": "Examples in S3",
"path": "/Examples/Public Data/Examples in S3.dst",
"uuid": "af2cb4de-40f5-4441-b82e-9b67136d0d6a"
}
,{
"description": "Data files for some examples are hosted by Infochimps.com in Amazon's cloud (S3). Using this data store will download these files into your system and requires internet access",
"id": 4,
"name": "Examples from Infochimps",
"path": "/Examples/Public Data/Examples from Infochimps.dst",
"uuid": "140ac500-2697-484f-a937-1ac2c617bd22"
}
,{
"description": "",
"id": 5,
"name": "diConnection",
"path": "/Applications/peter/diConnection.dst",
"uuid": "532e8a9d-87c2-42f1-9af3-af2e06a99034"
}
]Connection Dependencies
This API requires enabling Datameer's Advanced Governance plug-in.