1
0

update-connector-configuration-api.asciidoc 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. [[update-connector-configuration-api]]
  2. === Update connector configuration API
  3. ++++
  4. <titleabbrev>Update connector configuration</titleabbrev>
  5. ++++
  6. preview::[]
  7. Updates a connector's `configuration`, allowing for complete schema modifications or individual value updates within a registered configuration schema.
  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. `values`::
  24. (Optional, object) Configuration values for the connector, represented as a mapping of configuration fields to their respective values within a registered schema.
  25. `configuration`::
  26. (Optional, 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.
  27. Each `ConnectorConfiguration` object contains the following attributes:
  28. * `category` (Optional, string) The category of the configuration field. This helps in grouping related configurations together in the user interface.
  29. * `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.
  30. * `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.
  31. * `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`.
  32. * `label` (Required, string) The display label for the configuration field. This label is shown in the user interface, adjacent to the field.
  33. * `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.
  34. * `order` (Required, number) The order in which this configuration appears in the user interface. This helps in organizing fields logically.
  35. * `placeholder` (Required, string) Placeholder text for the configuration field. This text is displayed inside the field before a value is entered.
  36. * `required` (Required, boolean) Indicates whether the configuration is mandatory. If true, a value must be provided for the field.
  37. * `sensitive` (Required, boolean) Indicates whether the configuration contains sensitive information. Sensitive fields may be obfuscated in the user interface.
  38. * `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.
  39. * `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.
  40. * `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.
  41. * `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.
  42. * `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.
  43. `ConfigurationDependency` represents a dependency that a configuration field has on another field's value. It contains the following attributes:
  44. * `field` (Required, string) The name of the field in the configuration that this dependency relates to.
  45. * `value` (Required, string | number | bool) The required value of the specified field for this dependency to be met.
  46. `ConfigurationSelectOption` defines an option within a selectable configuration field. It contains the following attributes:
  47. * `label` (Required, string) The display label for the option.
  48. * `value` (Required, string) The actual value associated with the option.
  49. `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:
  50. * `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.
  51. * `type` (Required, ConfigurationValidationType) The type of validation to be performed. Possible values include: `less_than`, `greater_than`, `list_type`, `included_in`, `regex` and `unset`.
  52. [[update-connector-configuration-api-response-codes]]
  53. ==== {api-response-codes-title}
  54. `200`::
  55. Connector configuration was successfully updated.
  56. `400`::
  57. The `connector_id` was not provided or the request payload was malformed.
  58. `404` (Missing resources)::
  59. No connector matching `connector_id` could be found.
  60. [[update-connector-configuration-api-example]]
  61. ==== {api-examples-title}
  62. The following example updates the `configuration` for the connector with ID `my-connector`:
  63. ////
  64. [source, console]
  65. --------------------------------------------------
  66. PUT _connector/my-spo-connector
  67. {
  68. "index_name": "search-sharepoint-online",
  69. "name": "Sharepoint Online Connector",
  70. "service_type": "sharepoint_online"
  71. }
  72. PUT _connector/my-spo-connector/_configuration
  73. {
  74. "configuration": {
  75. "client_id": {
  76. "default_value": null,
  77. "depends_on": [],
  78. "display": "text",
  79. "label": "Client ID",
  80. "options": [],
  81. "order": 3,
  82. "required": true,
  83. "sensitive": false,
  84. "tooltip": null,
  85. "type": "str",
  86. "ui_restrictions": [],
  87. "validations": [],
  88. "value": null
  89. },
  90. "secret_value": {
  91. "default_value": null,
  92. "depends_on": [],
  93. "display": "text",
  94. "label": "Secret value",
  95. "options": [],
  96. "order": 4,
  97. "required": true,
  98. "sensitive": true,
  99. "tooltip": null,
  100. "type": "str",
  101. "ui_restrictions": [],
  102. "validations": [],
  103. "value": null
  104. }
  105. }
  106. }
  107. --------------------------------------------------
  108. // TESTSETUP
  109. [source,console]
  110. --------------------------------------------------
  111. DELETE _connector/my-spo-connector
  112. --------------------------------------------------
  113. // TEARDOWN
  114. ////
  115. This example demonstrates how to register a `sharepoint_online` connector configuration schema. Note: The example does not cover all the necessary configuration fields for operating the Sharepoint Online connector.
  116. [source,console]
  117. ----
  118. PUT _connector/my-spo-connector/_configuration
  119. {
  120. "configuration": {
  121. "client_id": {
  122. "default_value": null,
  123. "depends_on": [],
  124. "display": "text",
  125. "label": "Client ID",
  126. "options": [],
  127. "order": 3,
  128. "required": true,
  129. "sensitive": false,
  130. "tooltip": null,
  131. "type": "str",
  132. "ui_restrictions": [],
  133. "validations": [],
  134. "value": null
  135. },
  136. "secret_value": {
  137. "default_value": null,
  138. "depends_on": [],
  139. "display": "text",
  140. "label": "Secret value",
  141. "options": [],
  142. "order": 4,
  143. "required": true,
  144. "sensitive": true,
  145. "tooltip": null,
  146. "type": "str",
  147. "ui_restrictions": [],
  148. "validations": [],
  149. "value": null
  150. }
  151. }
  152. }
  153. ----
  154. [source,console-result]
  155. ----
  156. {
  157. "result": "updated"
  158. }
  159. ----
  160. An example to update configuration values for the `sharepoint_online` connector:
  161. [source,console]
  162. ----
  163. PUT _connector/my-spo-connector/_configuration
  164. {
  165. "values": {
  166. "client_id": "my-client-id",
  167. "secret_value": "super-secret-value"
  168. }
  169. }
  170. ----
  171. [source,console-result]
  172. ----
  173. {
  174. "result": "updated"
  175. }
  176. ----
  177. An example to update single configuration field of the `sharepoint_online` connector. In this case other configuration values won't change:
  178. [source,console]
  179. ----
  180. PUT _connector/my-spo-connector/_configuration
  181. {
  182. "values": {
  183. "secret_value": "new-super-secret-value"
  184. }
  185. }
  186. ----
  187. [source,console-result]
  188. ----
  189. {
  190. "result": "updated"
  191. }
  192. ----