Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Connector API] Add docs for create connector API #103177

Merged
merged 14 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions docs/reference/connector/apis/connector-apis.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[[connector-apis]]
== Connector APIs

preview::[]

++++
<titleabbrev>Connector APIs</titleabbrev>
++++

---

The connector and sync jobs API provides a convenient way to create and manage Elastic connectors and sync jobs in an internal index.

This API provides an alternative to relying solely on Kibana UI for connector and sync job management. The API comes with a set of
jedrazb marked this conversation as resolved.
Show resolved Hide resolved
validations and assertions to ensure that the state representation in the internal index remains valid.

[discrete]
[[elastic-connector-apis]]
=== Connector APIs

You can use these APIs to create, get, delete and update connectors.

Use the following APIs to manage connectors:

* <<create-connector-api>>


[discrete]
[[sync-job-apis]]
=== Sync Job APIs

You can use these APIs to create, cancel, delete and update sync jobs.

Use the following APIs to manage sync jobs:


include::create-connector-api.asciidoc[]
104 changes: 104 additions & 0 deletions docs/reference/connector/apis/create-connector-api.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
[[create-connector-api]]
=== Create Connector API
++++
<titleabbrev>Create Connector</titleabbrev>
jedrazb marked this conversation as resolved.
Show resolved Hide resolved
++++

Creates a connector.

[source,console]
--------------------------------------------------
POST _connector
{
"index_name": "search-google-drive",
"name": "My Connector",
"service_type": "google_drive"
}
--------------------------------------------------


[[create-connector-api-request]]
==== {api-request-title}
`POST _connector`
`PUT _connector/<connector_id>`
jedrazb marked this conversation as resolved.
Show resolved Hide resolved


[[create-connector-api-prereqs]]
==== {api-prereq-title}

* In order to utilize connectors for syncing data, it's essential to have the Elastic connectors service running.
jedrazb marked this conversation as resolved.
Show resolved Hide resolved
* The `service_type` parameter should reference an existing connector service type.


[[create-connector-api-desc]]
==== {api-description-title}

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.

[[create-connector-api-path-params]]
==== {api-path-parms-title}

`<connector_id>`::
(Required, string) Unique identifier of a connector.


[role="child_attributes"]
[[create-connector-api-request-body]]
==== {api-request-body-title}

`description`::
(Optional, string) The description of the connector.

`index_name`::
(Required, string) The target index for syncing data by the connector.

`name`::
(Optional, string) The name of the connector.

`is_native`::
(Optional, boolean) Indicates if it's a native connector. Defaults to false.
jedrazb marked this conversation as resolved.
Show resolved Hide resolved

`language`::
(Optional, string) Language analyzer for the data. Limited to supported languages.

`service_type`::
(Optional, string) Connector service type. Can reference Elastic-supported connector types or a custom connector type.


[role="child_attributes"]
[[create-connector-api-response-body]]
==== {api-response-body-title}

`id`::
(string) An ID associated with the connector document. Returned when using a POST request.

[[create-connector-api-response-codes]]
==== {api-response-codes-title}

`200`::
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be good to list other response codes too? Just playing around with the API a bit, I came across a 201 and a 500.

Copy link
Member Author

@jedrazb jedrazb Dec 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup added more. Actually the 500 is unexpected - I filed an issue to make a request body a required param (otherwise, without providing the body we can get 500 NullPointerException which is not clear to the user). Will fix it soon

Indicates that connector was created succesfully.


[[create-connector-api-example]]
==== {api-examples-title}

[source,console]
----
POST _connector
{
"index_name": "search-google-drive",
"name": "My Connector",
"description": "My Connector to sync data to Elastic index from Google Drive",
"service_type": "google_drive",
"language": "english"
}
----

The API returns the following result:

[source,console-result]
----
{
"id": "AU_oRIwBoQoEFXSZzPHY"
}
----
2 changes: 2 additions & 0 deletions docs/reference/rest-api/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ not be included yet.
* <<cluster, Cluster APIs>>
* <<features-apis,Features APIs>>
* <<ccr-apis,{ccr-cap} APIs>>
* <<connector-apis, Connector APIs>>
jedrazb marked this conversation as resolved.
Show resolved Hide resolved
* <<data-stream-apis,Data stream APIs>>
* <<docs, Document APIs>>
* <<enrich-apis,Enrich APIs>>
Expand Down Expand Up @@ -66,6 +67,7 @@ include::{es-repo-dir}/behavioral-analytics/apis/index.asciidoc[]
include::{es-repo-dir}/cat.asciidoc[]
include::{es-repo-dir}/cluster.asciidoc[]
include::{es-repo-dir}/ccr/apis/ccr-apis.asciidoc[]
include::{es-repo-dir}/connector/apis/connector-apis.asciidoc[]
include::{es-repo-dir}/data-streams/data-stream-apis.asciidoc[]
include::{es-repo-dir}/docs.asciidoc[]
include::{es-repo-dir}/ingest/apis/enrich/index.asciidoc[]
Expand Down