Categories

Versions

You are viewing the RapidMiner Hub documentation for version 9.8 - Check here for latest version

REST API for connections

Connection repository items are ZIP files (having the file extension .conninfo). These files include data, for example the JDBC driver JAR files and a configuration which defines the set of parameters which are available within a connection.

It is possible to upload the .conninfo (ZIP file) and .connmd (JSON metadata file) files via REST API. The following section will only outline how this can be achieved.

Please follow the instructions on the general REST API article on how to request a valid idToken.

In order to upload a custom .conninfo we need to issue a POST request to the location $LOCATION and add several specific HTTP headers to the endpoint $RMServerHost/api/rest/resources$LOCATION:

  • $LOCATION is an absolute repository location where the connection should be stored. Connections can only be stored within the pre-defined connections folder /Connections, therefore $LOCATION = /Connections/myConnection would save the uploaded .conninfo ZIP file as myConnection in the connections folder. Ensure that you don't add double slashes after the base endpoint url.
  • The header Content-Type has to be set to application/vnd.rapidminer.conninfo+zip
  • The header IOObject-Class has to be set to the connection type, for example to jdbc_connectors:jdbc for database connections.
  • The .conninfo ZIP file has to be referenced from the machine file system which uploads the connection as binary request
curl -X POST $RMServerHost/api/rest/resources/Connections/myConnection \
  -H 'Authorization: Bearer $idToken' \
  -H 'Content-Type: application/vnd.rapidminer.conninfo+zip' \
  -H 'IOObject-Class: jdbc_connectors:jdbc' \
  --data-binary '@/path/to/myConnection.conninfo'

Optionally it is also possible to upload the generated meta data of a connection item separately from the .conninfo file.

In order to do so, adjust Content-Type to application/vnd.rapidminer.conmd+json and skip the IOObject-Class header. You still need to reference the .connmd meta data file as binary.

curl -X POST $RMServerHost/api/rest/resources/Connections/myConnection \
  -H 'Authorization: Bearer $idToken' \
  -H 'Content-Type: application/vnd.rapidminer.conmd+json' \
  --data-binary '@/path/to/myConnection.connmd'

You can also use the --data parameter of cURL and insert the JSON meta data directly instead of referencing an existing file on your file system with the --data-binary parameter.