Categories

Versions

You are viewing the RapidMiner Server documentation for version 9.7 -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 generalREST APIarticle on how to request a valididToken.

In order to upload a custom.conninfowe need to issue aPOSTrequest to the location$LOCATIONand add several specific HTTP headers to the endpoint$RMServerHost/api/rest/resources$LOCATION:

  • $LOCATIONis 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/myConnectionwould save the uploaded.conninfoZIP file asmyConnectionin the connections folder. Ensure that you don't add double slashes after the base endpoint url.
  • The headerContent-Typehas to be set toapplication/vnd.rapidminer.conninfo+zip
  • The headerIOObject-Classhas to be set to the connection type, for example tojdbc_connectors:jdbcfor database connections.
  • The.conninfoZIP 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.conninfofile.

In order to do so, adjustContent-Typetoapplication/vnd.rapidminer.conmd+jsonand skip theIOObject-Classheader. You still need to reference the.connmdmeta 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--dataparameter of cURL and insert the JSON meta data directly instead of referencing an existing file on your file system with the--data-binaryparameter.