update-connector-api-key-id-api.asciidoc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. [[update-connector-api-key-id-api]]
  2. === Update connector API key ID API
  3. ++++
  4. <titleabbrev>Update connector API key id</titleabbrev>
  5. ++++
  6. beta::[]
  7. Updates the `api_key_id` and/or `api_key_secret_id` field(s) of a connector, specifying:
  8. . The ID of the API key used for authorization
  9. . The ID of the Connector Secret where the API key is stored
  10. The Connector Secret ID is only required for Elastic managed connectors.
  11. Self-managed connectors do not use this field.
  12. See the documentation for <<es-native-connectors-manage-API-keys-programmatically,programmatically managed connector API keys>> for more details.
  13. To get started with Connector APIs, check out <<es-connectors-tutorial-api, our tutorial>>.
  14. [[update-connector-api-key-id-api-request]]
  15. ==== {api-request-title}
  16. `PUT _connector/<connector_id>/_api_key_id`
  17. [[update-connector-api-key-id-api-prereq]]
  18. ==== {api-prereq-title}
  19. * To sync data using self-managed connectors, you need to deploy the <<es-connectors-deploy-connector-service,Elastic connector service>>. on your own infrastructure. This service runs automatically on Elastic Cloud for Elastic managed connectors.
  20. * The `connector_id` parameter should reference an existing connector.
  21. * The `api_key_id` parameter should reference an existing API key.
  22. * The `api_key_secret_id` parameter should reference an existing Connector Secret containing an encoded API key value.
  23. [[update-connector-api-key-id-api-path-params]]
  24. ==== {api-path-parms-title}
  25. `<connector_id>`::
  26. (Required, string)
  27. [role="child_attributes"]
  28. [[update-connector-api-key-id-api-request-body]]
  29. ==== {api-request-body-title}
  30. `api_key_id`::
  31. (Optional, string) ID of the API key that the connector will use to authorize access to required indices. Each connector can be associated with at most one API key.
  32. `api_key_secret_id`::
  33. (Optional, string) ID of the Connector Secret that contains the encoded API key. This should be the same API key as `api_key_id` references. This is only required for Elastic managed connectors.
  34. [[update-connector-api-key-id-api-response-codes]]
  35. ==== {api-response-codes-title}
  36. `200`::
  37. Connector `api_key_id` and/or `api_key_secret_id` field(s) successfully updated.
  38. `400`::
  39. The `connector_id` was not provided or the request payload was malformed.
  40. `404` (Missing resources)::
  41. No connector matching `connector_id` could be found.
  42. [[update-connector-api-key-id-api-example]]
  43. ==== {api-examples-title}
  44. The following example updates the `api_key_id` and `api_key_secret_id` field(s) for the connector with ID `my-connector`:
  45. ////
  46. [source, console]
  47. --------------------------------------------------
  48. PUT _connector/my-connector
  49. {
  50. "index_name": "search-google-drive",
  51. "name": "My Connector",
  52. "service_type": "google_drive"
  53. }
  54. --------------------------------------------------
  55. // TESTSETUP
  56. [source,console]
  57. --------------------------------------------------
  58. DELETE _connector/my-connector
  59. --------------------------------------------------
  60. // TEARDOWN
  61. ////
  62. [source,console]
  63. ----
  64. PUT _connector/my-connector/_api_key_id
  65. {
  66. "api_key_id": "my-api-key-id",
  67. "api_key_secret_id": "my-connector-secret-id"
  68. }
  69. ----
  70. [source,console-result]
  71. ----
  72. {
  73. "result": "updated"
  74. }
  75. ----