update-connector-status-api.asciidoc 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. [[update-connector-status-api]]
  2. === Update connector status API
  3. ++++
  4. <titleabbrev>Update connector status</titleabbrev>
  5. ++++
  6. preview::[]
  7. Updates the `status` of a connector.
  8. To get started with Connector APIs, check out the {enterprise-search-ref}/connectors-tutorial-api.html[tutorial^].
  9. [[update-connector-status-api-request]]
  10. ==== {api-request-title}
  11. `PUT _connector/<connector_id>/_status`
  12. [[update-connector-status-api-prereq]]
  13. ==== {api-prereq-title}
  14. * To sync data using self-managed connectors, you need to deploy the {enterprise-search-ref}/build-connector.html[Elastic connector service] on your own infrastructure. This service runs automatically on Elastic Cloud for native connectors.
  15. * The `connector_id` parameter should reference an existing connector.
  16. * The change of `status` must be a valid status transition according to the https://github.com/elastic/connectors/blob/main/docs/CONNECTOR_PROTOCOL.md[Connector Protocol].
  17. [[update-connector-status-api-path-params]]
  18. ==== {api-path-parms-title}
  19. `<connector_id>`::
  20. (Required, string)
  21. [role="child_attributes"]
  22. [[update-connector-status-api-request-body]]
  23. ==== {api-request-body-title}
  24. `status`::
  25. (Required, string) A valid connector status string, defined in the Connector Framework.
  26. [[update-connector-status-api-response-codes]]
  27. ==== {api-response-codes-title}
  28. `200`::
  29. Connector `status` field was successfully updated.
  30. `400`::
  31. The `connector_id` was not provided, the request payload was malformed, or the given status transition is not supported.
  32. `404` (Missing resources)::
  33. No connector matching `connector_id` could be found.
  34. [[update-connector-status-api-example]]
  35. ==== {api-examples-title}
  36. The following example updates the `status` of the connector with ID `my-connector`:
  37. ////
  38. [source, console]
  39. --------------------------------------------------
  40. PUT _connector/my-connector
  41. {
  42. "index_name": "search-google-drive",
  43. "name": "My Connector",
  44. "service_type": "needs_configuration"
  45. }
  46. --------------------------------------------------
  47. // TESTSETUP
  48. [source,console]
  49. --------------------------------------------------
  50. DELETE _connector/my-connector
  51. --------------------------------------------------
  52. // TEARDOWN
  53. ////
  54. [source,console]
  55. ----
  56. PUT _connector/my-connector/_status
  57. {
  58. "status": "needs_configuration"
  59. }
  60. ----
  61. [source,console-result]
  62. ----
  63. {
  64. "result": "updated"
  65. }
  66. ----