浏览代码

[Connector APIs] Add docs for sync job claim endpoint (#110412)

Jedr Blaszyk 1 年之前
父节点
当前提交
8417542edd

+ 68 - 0
docs/reference/connector/apis/claim-connector-sync-job-api.asciidoc

@@ -0,0 +1,68 @@
+[[claim-connector-sync-job-api]]
+=== Claim connector sync job API
+++++
+<titleabbrev>Claim connector sync job</titleabbrev>
+++++
+
+preview::[]
+
+Claims a connector sync job.
+
+The `_claim` endpoint is not intended for direct connector management by users. It is there to support the implementation of services that utilize the https://github.com/elastic/connectors/blob/main/docs/CONNECTOR_PROTOCOL.md[Connector Protocol] to communicate with {es}.
+
+To get started with Connector APIs, check out the {enterprise-search-ref}/connectors-tutorial-api.html[tutorial^].
+
+[[claim-connector-sync-job-api-request]]
+==== {api-request-title}
+`PUT _connector/_sync_job/<connector_sync_job_id>/_claim`
+
+[[claim-connector-sync-job-api-prereqs]]
+==== {api-prereq-title}
+
+* 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.
+* The `connector_sync_job_id` parameter should reference an existing connector sync job.
+
+[[claim-connector-sync-job-api-desc]]
+==== {api-description-title}
+
+Claims a connector sync job. This action updates the job's status to `in_progress` and sets the `last_seen` and `started_at` timestamps to the current time. Additionally, it can set the `sync_cursor` property for the sync job.
+
+[[claim-connector-sync-job-api-path-params]]
+==== {api-path-parms-title}
+
+`connector_sync_job_id`::
+(Required, string)
+
+[role="child_attributes"]
+[[claim-connector-sync-job-api-request-body]]
+==== {api-request-body-title}
+
+`worker_hostname`::
+(Required, string) The host name of the current system that will execute the job.
+
+`sync_cursor`::
+(Optional, Object) The cursor object from the last incremental sync job. This should reference the `sync_cursor` field in the connector state for which the job is executed.
+
+
+[[claim-connector-sync-job-api-response-codes]]
+==== {api-response-codes-title}
+
+`200`::
+Connector sync job was successfully claimed.
+
+`404`::
+No connector sync job matching `connector_sync_job_id` could be found.
+
+[[claim-connector-sync-job-api-example]]
+==== {api-examples-title}
+
+The following example claims the connector sync job with ID `my-connector-sync-job-id`:
+
+[source,console]
+----
+PUT _connector/_sync_job/my-connector-sync-job-id/_claim
+{
+  "worker_hostname": "some-machine"
+}
+----
+// 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.]

+ 3 - 0
docs/reference/connector/apis/connector-apis.asciidoc

@@ -108,6 +108,8 @@ preview:[]
 
 * <<check-in-connector-sync-job-api>>
 preview:[]
+* <<claim-connector-sync-job-api>>
+preview:[]
 * <<set-connector-sync-job-error-api>>
 preview:[]
 * <<set-connector-sync-job-stats-api>>
@@ -141,5 +143,6 @@ include::update-connector-last-sync-api.asciidoc[]
 include::update-connector-status-api.asciidoc[]
 
 include::check-in-connector-sync-job-api.asciidoc[]
+include::claim-connector-sync-job-api.asciidoc[]
 include::set-connector-sync-job-error-api.asciidoc[]
 include::set-connector-sync-job-stats-api.asciidoc[]