update-connector-scheduling-api.asciidoc 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. [[update-connector-scheduling-api]]
  2. === Update connector scheduling API
  3. ++++
  4. <titleabbrev>Update connector scheduling</titleabbrev>
  5. ++++
  6. beta::[]
  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. Updates the `scheduling` configuration of a connector.
  13. To get started with Connector APIs, check out <<es-connectors-tutorial-api, our tutorial>>.
  14. [[update-connector-scheduling-api-request]]
  15. ==== {api-request-title}
  16. `PUT _connector/<connector_id>/_scheduling`
  17. [[update-connector-scheduling-api-prereq]]
  18. ==== {api-prereq-title}
  19. * 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.
  20. * The `connector_id` parameter should reference an existing connector.
  21. [[update-connector-scheduling-api-path-params]]
  22. ==== {api-path-parms-title}
  23. `<connector_id>`::
  24. (Required, string)
  25. [role="child_attributes"]
  26. [[update-connector-scheduling-api-request-body]]
  27. ==== {api-request-body-title}
  28. `scheduling`::
  29. (Required, object) The scheduling configuration for the connector. This configuration determines frequency of synchronization operations for the connector.
  30. The scheduling configuration includes the following attributes, each represented as a `ScheduleConfig` object. If the `scheduling` object does not include all schedule types, only those provided will be updated; the others will remain unchanged.
  31. - `access_control` (Optional, `ScheduleConfig` object) Defines the schedule for synchronizing access control settings of the connector.
  32. - `full` (Optional, `ScheduleConfig` object) Defines the schedule for a full content syncs.
  33. - `incremental` (Optional, `ScheduleConfig` object) Defines the schedule for incremental content syncs.
  34. Each `ScheduleConfig` object includes the following sub-attributes:
  35. - `enabled` (Required, boolean) A flag that enables or disables the scheduling.
  36. - `interval` (Required, string) A CRON expression representing the sync schedule. This expression defines the grequency at which the sync operations should occur. It must be provided in a valid CRON format.
  37. [[update-connector-scheduling-api-response-codes]]
  38. ==== {api-response-codes-title}
  39. `200`::
  40. Connector `scheduling` field was successfully updated.
  41. `400`::
  42. The `connector_id` was not provided or the request payload was malformed.
  43. `404` (Missing resources)::
  44. No connector matching `connector_id` could be found.
  45. [[update-connector-scheduling-api-example]]
  46. ==== {api-examples-title}
  47. The following example updates the `scheduling` property for the connector with ID `my-connector`:
  48. ////
  49. [source, console]
  50. --------------------------------------------------
  51. PUT _connector/my-connector
  52. {
  53. "index_name": "search-google-drive",
  54. "name": "My Connector",
  55. "service_type": "google_drive"
  56. }
  57. --------------------------------------------------
  58. // TESTSETUP
  59. [source,console]
  60. --------------------------------------------------
  61. DELETE _connector/my-connector
  62. --------------------------------------------------
  63. // TEARDOWN
  64. ////
  65. [source,console]
  66. ----
  67. PUT _connector/my-connector/_scheduling
  68. {
  69. "scheduling": {
  70. "access_control": {
  71. "enabled": true,
  72. "interval": "0 10 0 * * ?"
  73. },
  74. "full": {
  75. "enabled": true,
  76. "interval": "0 20 0 * * ?"
  77. },
  78. "incremental": {
  79. "enabled": false,
  80. "interval": "0 30 0 * * ?"
  81. }
  82. }
  83. }
  84. ----
  85. [source,console-result]
  86. ----
  87. {
  88. "result": "updated"
  89. }
  90. ----
  91. The following example updates `full` sync schedule only, other schedule types remain unchanged:
  92. [source,console]
  93. ----
  94. PUT _connector/my-connector/_scheduling
  95. {
  96. "scheduling": {
  97. "full": {
  98. "enabled": true,
  99. "interval": "0 10 0 * * ?"
  100. }
  101. }
  102. }
  103. ----
  104. [source,console-result]
  105. ----
  106. {
  107. "result": "updated"
  108. }
  109. ----