elasticsearch/docs/reference/connector/apis/update-connector-status-api.asciidoc
2024-12-31 20:21:46 +00:00

94 lines
2.4 KiB
Text

[[update-connector-status-api]]
=== Update connector status API
++++
<titleabbrev>Update connector status</titleabbrev>
++++
preview::[]
.New API reference
[sidebar]
--
For the most up-to-date API details, refer to {api-es}/group/endpoint-connector[Connector APIs].
--
Updates the `status` of a connector.
To get started with Connector APIs, check out <<es-connectors-tutorial-api, our tutorial>>.
[[update-connector-status-api-request]]
==== {api-request-title}
`PUT _connector/<connector_id>/_status`
[[update-connector-status-api-prereq]]
==== {api-prereq-title}
* 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.
* The `connector_id` parameter should reference an existing connector.
* 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].
[[update-connector-status-api-path-params]]
==== {api-path-parms-title}
`<connector_id>`::
(Required, string)
[role="child_attributes"]
[[update-connector-status-api-request-body]]
==== {api-request-body-title}
`status`::
(Required, string) A valid connector status string, defined in the Connector Framework.
[[update-connector-status-api-response-codes]]
==== {api-response-codes-title}
`200`::
Connector `status` field was successfully updated.
`400`::
The `connector_id` was not provided, the request payload was malformed, or the given status transition is not supported.
`404` (Missing resources)::
No connector matching `connector_id` could be found.
[[update-connector-status-api-example]]
==== {api-examples-title}
The following example updates the `status` of the connector with ID `my-connector`:
////
[source, console]
--------------------------------------------------
PUT _connector/my-connector
{
"index_name": "search-google-drive",
"name": "My Connector",
"service_type": "needs_configuration"
}
--------------------------------------------------
// TESTSETUP
[source,console]
--------------------------------------------------
DELETE _connector/my-connector
--------------------------------------------------
// TEARDOWN
////
[source,console]
----
PUT _connector/my-connector/_status
{
"status": "needs_configuration"
}
----
[source,console-result]
----
{
"result": "updated"
}
----