elasticsearch/docs/reference/connector/apis/cancel-connector-sync-job-api.asciidoc
2024-12-31 11:32:29 -08:00

60 lines
1.9 KiB
Text

[[cancel-connector-sync-job-api]]
=== Cancel connector sync job API
++++
<titleabbrev>Cancel connector sync job</titleabbrev>
++++
beta::[]
.New API reference
[sidebar]
--
For the most up-to-date API details, refer to {api-es}/group/endpoint-connector[Connector APIs].
--
Cancels a connector sync job.
To get started with Connector APIs, check out <<es-connectors-tutorial-api, our tutorial>>.
[[cancel-connector-sync-job-api-request]]
==== {api-request-title}
`PUT _connector/_sync_job/<connector_sync_job_id>/_cancel`
[[cancel-connector-sync-job-api-prereqs]]
==== {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_sync_job_id` parameter should reference an existing connector sync job.
[[cancel-connector-sync-job-api-desc]]
==== {api-description-title}
Cancels a connector sync job, which sets the `status` to `cancelling` and updates `cancellation_requested_at` to the current time.
The connector service is then responsible for setting the `status` of connector sync jobs to `cancelled`.
[[cancel-connector-sync-job-api-path-params]]
==== {api-path-parms-title}
`connector_sync_job_id`::
(Required, string)
[[cancel-connector-sync-job-api-response-codes]]
==== {api-response-codes-title}
`200`::
Connector sync job cancellation was successfully requested.
`404`::
No connector sync job matching `connector_sync_job_id` could be found.
[[cancel-connector-sync-job-api-example]]
==== {api-examples-title}
The following example cancels the connector sync job with ID `my-connector-sync-job-id`:
[source,console]
----
PUT _connector/_sync_job/my-connector-sync-job-id/_cancel
----
// TEST[skip:there's no way to clean up after creating a connector sync job, as we don't know the id ahead of time. Therefore, skip this test.]