This is a translation of the original English documentation page. Help us make it better.

connector.create

Description

object connector.create(object/array connectors)

This method allows to create new connector objects.

This method is only available to Super admin user type. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object/array) Connector objects to create.

Additionally to the standard connector properties, the method accepts the following parameters.

Parameter Type Description
tags array Connector tag filter.

Return values

(object) Returns an object containing the IDs of the created connectors under the connectorids property. The order of the returned IDs matches the order of the passed connectors.

Приклади

Creating a connector

Create a connector to export trigger events with a tag filter. HTTP authentication will be performed using Bearer token.

Request:

{
           "jsonrpc": "2.0",
           "method": "connector.create",
           "params": [
               {
                   "name": "Export of events",
                   "data_type": 1,
                   "url": "{$DATA_EXPORT_URL}",
                   "authtype": 5,
                   "token": "{$DATA_EXPORT_BEARER_TOKEN}",
                   "tags": [
                       {
                           "tag": "service",
                           "operator": 0,
                           "value": "mysqld"
                       }
                   ]
               }
           ],
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "connectorid": [
                   "3"
               ]
           },
           "id": 1
       }

Source

CConnector::create() in ui/include/classes/api/services/CConnector.php.