update-connector-configuration-api.asciidoc 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. [[update-connector-configuration-api]]
  2. === Update connector configuration API
  3. ++++
  4. <titleabbrev>Update connector configuration</titleabbrev>
  5. ++++
  6. preview::[]
  7. Updates the `configuration` of a connector.
  8. [[update-connector-configuration-api-request]]
  9. ==== {api-request-title}
  10. `PUT _connector/<connector_id>/_configuration`
  11. [[update-connector-configuration-api-prereq]]
  12. ==== {api-prereq-title}
  13. * To sync data using connectors, it's essential to have the Elastic connectors service running.
  14. * The `connector_id` parameter should reference an existing connector.
  15. * The configuration fields definition must be compatible with the specific connector type being used.
  16. [[update-connector-configuration-api-path-params]]
  17. ==== {api-path-parms-title}
  18. `<connector_id>`::
  19. (Required, string)
  20. [role="child_attributes"]
  21. [[update-connector-configuration-api-request-body]]
  22. ==== {api-request-body-title}
  23. `configuration`::
  24. (Required, object) The configuration for the connector. The configuration field is a map where each key represents a specific configuration field name, and the value is a `ConnectorConfiguration` object.
  25. Each `ConnectorConfiguration` object contains the following attributes:
  26. * `category` (Optional, string) The category of the configuration field. This helps in grouping related configurations together in the user interface.
  27. * `default_value` (Required, string | number | bool) The default value for the configuration. This value is used if the value field is empty, applicable only for non-required fields.
  28. * `depends_on` (Required, array of `ConfigurationDependency`) An array of dependencies on other configurations. A field will not be enabled unless these dependencies are met. Each dependency specifies a field key and the required value for the dependency to be considered fulfilled.
  29. * `display` (Required, string) The display type for the UI element that represents this configuration. This defines how the field should be rendered in the user interface. Supported types are: `text`, `textbox`, `textarea`, `numeric`, `toggle` and `dropdown`.
  30. * `label` (Required, string) The display label for the configuration field. This label is shown in the user interface, adjacent to the field.
  31. * `options` (Required, array of `ConfigurationSelectOption`) An array of options for list-type fields. These options are used for inputs in the user interface, each having a label for display and a value.
  32. * `order` (Required, number) The order in which this configuration appears in the user interface. This helps in organizing fields logically.
  33. * `placeholder` (Required, string) Placeholder text for the configuration field. This text is displayed inside the field before a value is entered.
  34. * `required` (Required, boolean) Indicates whether the configuration is mandatory. If true, a value must be provided for the field.
  35. * `sensitive` (Required, boolean) Indicates whether the configuration contains sensitive information. Sensitive fields may be obfuscated in the user interface.
  36. * `tooltip` (Optional, string) Tooltip text providing additional information about the configuration. This text appears when the user hovers over the info icon next to the configuration field.
  37. * `type` (Required, string) The type of the configuration field, such as `str`, `int`, `bool`, `list`. This defines the data type and format of the field's value.
  38. * `ui_restrictions` (Required, array of strings) A list of UI restrictions. These restrictions define where in the user interface this field should be available or restricted.
  39. * `validations` (Required, array of `ConfigurationValidation`) An array of rules for validating the field's value. Each validation specifies a type and a constraint that the field's value must meet.
  40. * `value` (Required, string | number | bool) The current value of the configuration. This is the actual value set for the field and is used by the connector during its operations.
  41. `ConfigurationDependency` represents a dependency that a configuration field has on another field's value. It contains the following attributes:
  42. * `field` (Required, string) The name of the field in the configuration that this dependency relates to.
  43. * `value` (Required, string | number | bool) The required value of the specified field for this dependency to be met.
  44. `ConfigurationSelectOption` defines an option within a selectable configuration field. It contains the following attributes:
  45. * `label` (Required, string) The display label for the option.
  46. * `value` (Required, string) The actual value associated with the option.
  47. `ConfigurationValidation` specifies validation rules for configuration fields. Each ConfigurationValidation instance enforces a specific type of validation based on its type and constraint. It contains the following attributes:
  48. * `constraint` (Required, string | number) The validation constraint. The nature of this constraint depends on the validation type. It could be a numeric value, a list, a regular expression pattern.
  49. * `type` (Required, ConfigurationValidationType) The type of validation to be performed. Possible values include: `less_than`, `greater_than`, `list_type`, `included_in`, `regex` and `unset`.
  50. [[update-connector-configuration-api-response-codes]]
  51. ==== {api-response-codes-title}
  52. `200`::
  53. Connector configuration was successfully updated.
  54. `400`::
  55. The `connector_id` was not provided or the request payload was malformed.
  56. `404` (Missing resources)::
  57. No connector matching `connector_id` could be found.
  58. [[update-connector-configuration-api-example]]
  59. ==== {api-examples-title}
  60. The following example updates the `configuration` for the connector with ID `my-connector`:
  61. ////
  62. [source, console]
  63. --------------------------------------------------
  64. PUT _connector/my-connector
  65. {
  66. "index_name": "search-google-drive",
  67. "name": "My Connector",
  68. "service_type": "google_drive"
  69. }
  70. --------------------------------------------------
  71. // TESTSETUP
  72. [source,console]
  73. --------------------------------------------------
  74. DELETE _connector/my-connector
  75. --------------------------------------------------
  76. // TEARDOWN
  77. ////
  78. [source,console]
  79. ----
  80. PUT _connector/my-connector/_configuration
  81. {
  82. "configuration": {
  83. "service_account_credentials": {
  84. "default_value": null,
  85. "depends_on": [],
  86. "display": "textarea",
  87. "label": "Google Drive service account JSON",
  88. "options": [],
  89. "order": 1,
  90. "required": true,
  91. "sensitive": true,
  92. "tooltip": "This connectors authenticates as a service account to synchronize content from Google Drive.",
  93. "type": "str",
  94. "ui_restrictions": [],
  95. "validations": [],
  96. "value": "...service account JSON..."
  97. }
  98. }
  99. }
  100. ----
  101. [source,console-result]
  102. ----
  103. {
  104. "result": "updated"
  105. }
  106. ----