update-connector-status-api.asciidoc 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. [[update-connector-status-api]]
  2. === Update connector status API
  3. ++++
  4. <titleabbrev>Update connector status</titleabbrev>
  5. ++++
  6. preview::[]
  7. .New API reference
  8. [sidebar]
  9. --
  10. For the most up-to-date API details, refer to {api-es}/group/endpoint-connector[Connector APIs].
  11. --
  12. Updates the `status` of a connector.
  13. To get started with Connector APIs, check out <<es-connectors-tutorial-api, our tutorial>>.
  14. [[update-connector-status-api-request]]
  15. ==== {api-request-title}
  16. `PUT _connector/<connector_id>/_status`
  17. [[update-connector-status-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 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].
  22. [[update-connector-status-api-path-params]]
  23. ==== {api-path-parms-title}
  24. `<connector_id>`::
  25. (Required, string)
  26. [role="child_attributes"]
  27. [[update-connector-status-api-request-body]]
  28. ==== {api-request-body-title}
  29. `status`::
  30. (Required, string) A valid connector status string, defined in the Connector Framework.
  31. [[update-connector-status-api-response-codes]]
  32. ==== {api-response-codes-title}
  33. `200`::
  34. Connector `status` field was successfully updated.
  35. `400`::
  36. The `connector_id` was not provided, the request payload was malformed, or the given status transition is not supported.
  37. `404` (Missing resources)::
  38. No connector matching `connector_id` could be found.
  39. [[update-connector-status-api-example]]
  40. ==== {api-examples-title}
  41. The following example updates the `status` of the connector with ID `my-connector`:
  42. ////
  43. [source, console]
  44. --------------------------------------------------
  45. PUT _connector/my-connector
  46. {
  47. "index_name": "search-google-drive",
  48. "name": "My Connector",
  49. "service_type": "needs_configuration"
  50. }
  51. --------------------------------------------------
  52. // TESTSETUP
  53. [source,console]
  54. --------------------------------------------------
  55. DELETE _connector/my-connector
  56. --------------------------------------------------
  57. // TEARDOWN
  58. ////
  59. [source,console]
  60. ----
  61. PUT _connector/my-connector/_status
  62. {
  63. "status": "needs_configuration"
  64. }
  65. ----
  66. [source,console-result]
  67. ----
  68. {
  69. "result": "updated"
  70. }
  71. ----