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.sh
that can encrypt sensitive information before it is sent via REST to Datameer.- The tool is called
encrypt.sh
and is located in the bin folder within Datameer.Syntax
encrypt.sh -v <password to encrypt>
Example Response
SECURE:0:hnDNk3ZOWZn9bwDiGp7MNuvyEZPHIinQ
- The tool is called
- 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
The following API is available in the Advanced Governance module.
Request method - GET
Description
Returns the hierarchy of up- and downstream dependencies for a given connection.
URI syntax
curl -u '<username>:<password>' -X GET 'http://<server>:<port>/api/connections/<configurationId>/dependencies[?direction=<upstream | downstream>][&level=<number>]'
Example response
{ "dependencies": [ { "id": 13, "file": { "path": "/Data/ImportJobs/TechCrunch_continental_USA", "name": "TechCrunch_continental_USA", "type": "imp", "description": "A listing of company funding records reported by TechCrunch.", "uuid": "47c25d9a-6a71-4778-8f88-c42217b39a08" } }, { "id": 10, "file": { "path": "/Data/ImportJobs/Sales_Jan_2009", "name": "Sales_Jan_2009", "type": "imp", "description": "Sales transactions during the month of January 2009.", "uuid": "158dc464-db46-4da8-af51-cf8be06cadc4" } }
Additional notes
Path parameters:
- configurationId:
- Data type must be a number
- Use the configuration ID
Query parameters:
- Direction:
- Data type must be a string
- Optional
- Shows either upstream or downstream
- If left blank, shows both
- Level:
- Data type must be a number
- Optional
- If left blank, shows all levels
How-tos
Step-by-step guide
How to create a connection via REST API calls
If your file name includes " "
(empty spaces), replace those spaces with "+"
.