claim-connector-sync-job-api.asciidoc 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. [[claim-connector-sync-job-api]]
  2. === Claim connector sync job API
  3. ++++
  4. <titleabbrev>Claim connector sync job</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. Claims a connector sync job.
  13. 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}.
  14. To get started with Connector APIs, check out <<es-connectors-tutorial-api, our tutorial>>.
  15. [[claim-connector-sync-job-api-request]]
  16. ==== {api-request-title}
  17. `PUT _connector/_sync_job/<connector_sync_job_id>/_claim`
  18. [[claim-connector-sync-job-api-prereqs]]
  19. ==== {api-prereq-title}
  20. * 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.
  21. * The `connector_sync_job_id` parameter should reference an existing connector sync job.
  22. [[claim-connector-sync-job-api-desc]]
  23. ==== {api-description-title}
  24. 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.
  25. [[claim-connector-sync-job-api-path-params]]
  26. ==== {api-path-parms-title}
  27. `connector_sync_job_id`::
  28. (Required, string)
  29. [role="child_attributes"]
  30. [[claim-connector-sync-job-api-request-body]]
  31. ==== {api-request-body-title}
  32. `worker_hostname`::
  33. (Required, string) The host name of the current system that will execute the job.
  34. `sync_cursor`::
  35. (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.
  36. [[claim-connector-sync-job-api-response-codes]]
  37. ==== {api-response-codes-title}
  38. `200`::
  39. Connector sync job was successfully claimed.
  40. `404`::
  41. No connector sync job matching `connector_sync_job_id` could be found.
  42. [[claim-connector-sync-job-api-example]]
  43. ==== {api-examples-title}
  44. The following example claims the connector sync job with ID `my-connector-sync-job-id`:
  45. [source,console]
  46. ----
  47. PUT _connector/_sync_job/my-connector-sync-job-id/_claim
  48. {
  49. "worker_hostname": "some-machine"
  50. }
  51. ----
  52. // 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.]