Loader Connections ================== .. code-block:: http /api/admin/loaderconnections .. _lc_show_all: List all loader connections ~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. http:get:: /api/admin/loaderconnections :synopsis: List all loader connections Returns a list of all loader connections. .. code-block:: http GET /api/admin/loaderconnections HTTP/1.1 .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, No error The response will be a :doc:`/standard-response`. Please note that Loader Connection response has been changed as follows: - ``Type`` column now returns 'fixed-length' instead of 'trillium' for fixed-length connections - ``Enabled`` and ``Single Sign-On`` columns now returns Yes/No instead of 1/0 - ``Repository Access`` returns 'None' instead of blank when no repository access has been restricted - ``Note Count`` column updated to return 0 when no notes are available - Added missing columns ``Created By``, ``Created Date``, ``Edited By``, ``Edited Date`` and ``Note Count`` The columns displayed for each loader connection are: .. csv-table:: :header: Human Name, Column Name, Description :widths: 25, 25, 50 "Connection Id", "CONNECTION", "Unique identifier of the connection" "Name", "NAME", "The name of the connection" "Type", "_type", "The connection type" "Description", "DESCRIPTION", "A description of the connection" "Parameters", "PARAMETERS", "The connection parameters" "Filter", "_defaults", "The default source filter" "Repository Access", "_access", "Repositories with access to this loader connection" "Single Sign-On", "_sso", "Is Single Sign-On used for this connection?" "Enabled", "_enabled", "Available for new connections" "Created By", "CREATED_BY", "User that created the connection" "Created Date", "_created_date", "When the connection was created" "Edited By", "EDITED_BY", "User that last edited the connection" "Edited Date", "_edited_date", "When the connection was edited" "Note Count", "_note_count", "Number of notes" The ``rows`` array will contain one element for each loader connections: .. code-block:: json { "dataRow": [ "1", "TSQ", "fixed-length", "Default TSQ file connection", "SCHEMA_DIRECTORY {C:/Trillium Software/MBSW/16/Data/import/schemas} DATA_DIRECTORY {C:/Trillium Software/MBSW/16/Data/import/data} SCHEMA_EXTENSIONS ddx DATA_EXTENSIONS dat", "*", "All", "No", "Yes", "madmin", "2017/03/14 16:13:23", "", "", "0" ] "metadata": { "url": "/api/admin/loaderconnections/1" } } .. _lc_show_single: List a specific loader connection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. http:get:: /api/admin/loaderconnections/(int:loaderConnectionID) :synopsis: Return a specific loader connection Returns a specific loader connection. .. code-block:: http GET /api/admin/loaderconnections/1 HTTP/1.1 The response will be the same as shown above with a single element returned in the ``rows`` array. If the specified loader connection does not exist, ``rows`` will be empty. Post --- .. http:post:: /api/admin/loaderconnections :synopsis: Allows to post various commands to manage loader connections Allows to post various commands to manage loader connections. :jsonparam body: The request body .. code-block:: http POST /api/admin/loaderconnections HTTP/1.1 Content-Type: application/json { "command": "", "data": {} } The commands that can be performed against loader connections are as follows: .. csv-table:: :header: Command, Purpose :widths: 20, 80 `add`_, Add a new loader connection `edit`_, Edit an existing loader connection (including enable/disable loader connection) The response depends on which operation was performed. .. csv-table:: :header: Command, Response :widths: 20, 80 `add`_, Returns status 200 - URL of the connection `edit`_, Returns status 200 - URL of the connection A post request may return any of the following status codes: .. csv-table:: :header: Response Code, Reason :widths: 25, 75 200, Success (URL of the connection) 400, Invalid request body (any request errors) 500, Server error .. _lc_get: Get --- The request to get a list of loader connections looks like: .. code-block:: http POST /api/admin/loaderconnections HTTP/1.1 Content-Type: application/json { "command": "get", "options": { "where": "'Connection Id' = 1" } } The request packet must contain the ``command`` element. .. _lc_add: Add --- To add a loader connection, the request may contain the fields below: .. code-block:: json { "command": "add", "data": { "name": "cobolLoader", "type": "cobol", "description": "loader type cobol", "parameters": { "dataDirectory": "C:/Trillium Software/MBSW/16/Data/import/data", "dataExtensions": "txt csv dat", "schemaDirectory": "C:/Trillium Software/MBSW/16/Data/import/schemas", "schemaExtensions": "ddl" }, "defaults": "", "metabaseName": [ "repository1", "repository2" ], "authentication": "0" } } The required fields for adding a loader connection are: + ``name`` + ``type`` + ``description`` + ``parameters`` The ``type`` and ``parameters`` fields are mutually dependent. The data supplied within ``parameters`` field is dependent on the type of connection selected. See :doc:`connection types ` for more information. The other remaining fields are optional; it is possible to add a loader connection without specifying them. The ``metabaseName`` field is used to select one or more repositories that are to be given access to this loader connection. This field can be omitted or left empty to allow all repositories to access this loader connection. The ``authentication`` field if supplied, can only be set to 1 (Enabled) for connection type ``odbc`` or ``generic``, otherwise it must set to 0 (Disabled). When a new loader connection is added it will be enabled by default. If the ``enabled`` field is specified in the request, the connection will be enabled or disabled depending on the value of the field. For example, to add an HDFS Loader Connection, use fields similar to the following: .. code-block:: json { "command" : "add", "data": { "name": "HDFS Delimited", "type": "hdfs_delimited", "enabled": 1, "description": "Delimited HDFS Loader Connection", "defaults": "*", "metabaseName": "", "authentication": "0", "parameters": { "nameNodeAddress": "hdfs://hdp2-02-master.syncdi1.us.syncsort.com:8020", "dataDirectory": "/user/apatel/data/data1", "dataExtensions": "txt csv", "schemaDirectory": "/user/apatel/data/data1", "schemaExtensions": "ddl" } } } .. _lc_edit: Edit ---- To edit a loader connection, the request may contain the fields below: .. code-block:: json { "command": "edit", "data": { "connection": "8", "name": "cobolLoader1", "type": "cobol", "description": "loader type cobol", "parameters": { "dataDirectory": "C:/ProgramData/Trillium Software/MBSW/16/Data/import/data", "dataExtensions": "txt csv dat", "schemaDirectory": "C:/ProgramData/Trillium Software/MBSW/16/Data/import/schemas", "schemaExtensions": "ddl" }, "defaults": "", "metabaseName": [], "authentication": "0" } } The required fields for editing an existing loader connection are: + ``connection`` + Any field(s) that needs to be updated The ``name``, ``type``, ``description`` and ``parameters`` fields are optional; if supplied, they cannot be left empty. It is possible to edit a loader connections without specifying these fields. The ``type`` and ``parameters`` fields are mutually dependent. The data supplied within the ``parameters`` field is dependent on the type of connection selected. See :doc:`connection types ` for more information. The other remaining fields are optional; it is possible to edit a connection without specifying them. The ``metabaseName`` field is used to select one or more repositories that are to be given access to this loader connection. When editing this field can be omitted to leave previous selections unchanged or can be left empty to allow all repositories to access this loader connection. The ``authentication`` field, if supplied, can only be set to 1 (Enabled) for connection type ``odbc`` or ``generic``; otherwise, it must be set to 0 (Disabled). .. _lc_enable: Enable/Disable Loader Connection -------------------------------- To enable or disable a loader connection, the request must contain the fields below: .. code-block:: json { "command": "edit", "data": { "connection": "8", "enabled": "1" } } The required fields for enabling or disabling an existing loader connection are: + ``connection`` + ``enabled`` The loader connection can be enabled or disabled as follows: + Set ``enabled`` field to 1 to enable a loader connection + Set ``enabled`` field to 0 to disable a loader connection