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

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