create-connector-api.asciidoc 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. [[create-connector-api]]
  2. === Create connector API
  3. ++++
  4. <titleabbrev>Create connector</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. Creates an Elastic connector.
  13. Connectors are {es} integrations that bring content from third-party data sources, which can be deployed on {ecloud} or hosted on your own infrastructure:
  14. * *Managed connectors* are a managed service on {ecloud}
  15. * *Self-managed connectors* are self-hosted on your infrastructure
  16. Find a list of all supported service types in the <<es-connectors,connectors documentation>>.
  17. To get started with Connector APIs, check out <<es-connectors-tutorial-api, our tutorial>>.
  18. [source,console]
  19. --------------------------------------------------
  20. PUT _connector/my-connector
  21. {
  22. "index_name": "search-google-drive",
  23. "name": "My Connector",
  24. "service_type": "google_drive"
  25. }
  26. --------------------------------------------------
  27. ////
  28. [source,console]
  29. ----
  30. DELETE _connector/my-connector
  31. ----
  32. // TEST[continued]
  33. ////
  34. [[create-connector-api-request]]
  35. ==== {api-request-title}
  36. * `POST _connector`
  37. * `PUT _connector/<connector_id>`
  38. [[create-connector-api-prereqs]]
  39. ==== {api-prereq-title}
  40. * 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.
  41. * The `service_type` parameter should reference a supported third-party service. See the available service types for <<es-native-connectors,Elastic managed>> and <<es-build-connector,self-managed>> connectors. This can also reference the service type of your custom connector.
  42. [[create-connector-api-desc]]
  43. ==== {api-description-title}
  44. Creates a connector document in the internal index and initializes its configuration, filtering, and scheduling with default values. These values can be updated later as needed.
  45. [[create-connector-api-path-params]]
  46. ==== {api-path-parms-title}
  47. `<connector_id>`::
  48. (Optional, string) Unique identifier of a connector.
  49. [role="child_attributes"]
  50. [[create-connector-api-request-body]]
  51. ==== {api-request-body-title}
  52. `description`::
  53. (Optional, string) The description of the connector.
  54. `index_name`::
  55. (Optional, string) The target index to sync data. If the index doesn't exist, it will be created upon the first sync.
  56. `name`::
  57. (Optional, string) The name of the connector. Setting the connector name is recommended when managing connectors in {kib}.
  58. `is_native`::
  59. (Optional, boolean) Indicates if it's a managed connector. Defaults to `false`.
  60. `language`::
  61. (Optional, string) Language analyzer for the data. Limited to supported languages.
  62. `service_type`::
  63. (Optional, string) Connector service type. Can reference Elastic-supported third-party services or a custom connector type. See the available service types for <<es-native-connectors,Elastic managed>> and <<es-build-connector,self-managed>> connectors.
  64. [role="child_attributes"]
  65. [[create-connector-api-response-body]]
  66. ==== {api-response-body-title}
  67. `id`::
  68. (string) The ID associated with the connector document. Returned when using a POST request.
  69. `result`::
  70. (string) The result of the indexing operation, `created` or `updated`. Returned when using a PUT request.
  71. [[create-connector-api-response-codes]]
  72. ==== {api-response-codes-title}
  73. `200`::
  74. Indicates that an existing connector was updated successfully.
  75. `201`::
  76. Indicates that the connector was created successfully.
  77. `400`::
  78. Indicates that the request was malformed.
  79. [[create-connector-api-example]]
  80. ==== {api-examples-title}
  81. [source,console]
  82. ----
  83. PUT _connector/my-connector
  84. {
  85. "index_name": "search-google-drive",
  86. "name": "My Connector",
  87. "description": "My Connector to sync data to Elastic index from Google Drive",
  88. "service_type": "google_drive",
  89. "language": "en"
  90. }
  91. ----
  92. The API returns the following result:
  93. [source,console-result]
  94. ----
  95. {
  96. "result": "created",
  97. "id": "my-connector"
  98. }
  99. ----
  100. ////
  101. [source,console]
  102. ----
  103. DELETE _connector/my-connector
  104. ----
  105. // TEST[continued]
  106. ////