# Creating Endpoints

## Required API

To create an endpoint you will need to use a number of different services APIs.&#x20;

* [endpoint-depot](https://documenter.getpostman.com/view/12031716/UVsSP4EP?version=latest#5518d035-d234-4a39-868c-e2eb73fb4c8a)
* [connector-depot](https://documenter.getpostman.com/view/12031716/UVsSP4EP?version=latest#0c79aaff-919f-4129-b1f6-c933594ec0a4)
* [adapter-read](https://documenter.getpostman.com/view/12031716/UVsSP4EP?version=latest#40b7c01e-c19b-4153-a839-f6d4666f3a6c)
  * based on the selected connector
* [adapter-write](https://documenter.getpostman.com/view/12031716/UVsSP4EP?version=latest#8e9d5d54-6a99-47dd-b197-2115a74b22c3)
  * based on the selected connector
* [taxi-pickup](https://documenter.getpostman.com/view/12031716/UVsSP4EP?version=latest#b095319d-b795-441b-83b4-a7946d1e367b)
* [taxi-dropoff](https://documenter.getpostman.com/view/12031716/UVsSP4EP?version=latest#5f91d62e-8a1a-429a-9fc1-1d1866b3aafa)

## Selecting a connector

You first need to know what connector you will be using with your endpoint.&#x20;

You can view all the connectors using the connector-depot's [/connectors endpoint](https://documenter.getpostman.com/view/12031716/UVsSP4EP?version=latest#9372b264-9908-4243-a46e-e1737375255f).

```
curl --request GET '{{impulse-protocol}}://{{impulse-domain}}:{{impulse-port}}/public/connector-depot/connectors'
```

This request will list all the available connectors. You will need the `id` of the connector you want to use with the endpoint.&#x20;

## Saving an Endpoint

Now that you know the connector ID, you will need to save the endpoint to the endpoint-depot.&#x20;

You can do this by using the endpoint-depot [/endpoints endpoint](https://documenter.getpostman.com/view/12031716/UVsSP4EP?version=latest#a851699c-35ac-406a-a987-03e0d3867353).&#x20;

an example request would be as follows:&#x20;

```
curl --request POST '{{impulse-protocol}}://{{impulse-domain}}:{{impulse-port}}/private/endpoint-depot/endpoints' \
--header 'Content-Type: application/json' \
--data-raw '{
	"name" : "my-endpoint",
	"connectorId": "12dcb152-51b5-422a-b2f3-615dd3387fbd",
	"contentRepo" : "dotcms",
	"contentRepoVersion" : "5.2.7",
	"active": true
}'
```

Be sure to get use the correct `contentRepo` and `contentRepoVersion` when saving the endpoint. View the specific connector's doc for more details.&#x20;

The response returned after the endpoint is saved will contain the endpoint ID. You will need to make note of this ID and use it in the following API.&#x20;

## Source Connector Config

### Adapter Read Config

Once an endpoint is created and you have it's ID, you need to save config to connect to your chosen repository. The adapter read config is only available for connectors level 2 or level 3. The config is required to sync content from the repository or for full Impulse capabilities, such as diff reporting. Without this config, the content will not be picked up and saved into Impulse.&#x20;

Based on which connector you want to use for the endpoint you will use a different config API. View the specific [connectors user doc](/impulse-user-manual/connectors.md) and [API doc](https://documenter.getpostman.com/view/12031716/UVsSP4EP?version=latest#40b7c01e-c19b-4153-a839-f6d4666f3a6c) for more information. For this example we will use the dotCMS source connector. As such you will need to create the config payload. All connectors configs have few matching attributes.&#x20;

* `endPointId`
  * The endpoint ID of the associated endpoint
* `taxiPickupURL`
  * The **relative** URL of the pickup taxi
  * Public Impulse uses the value: `http://taxi-pickup-app:8080`
* `taxiDropoffURL`
  * The **relative** URL of the drop off taxi
  * Public Impulse uses the value: `http://taxi-`dropoff`-app:8080`

The dotCMS adapter has specific properties that are listed in both the [API doc](https://documenter.getpostman.com/view/12031716/UVsSP4EP?version=latest#df09d9af-88a7-424a-bd69-56381d792f57) and the [dotCMS source connector doc](/impulse-user-manual/connectors/source-connectors/dotcms.md).&#x20;

Making the example request:&#x20;

```
curl --request PUT '{{impulse-protocol}}://{{impulse-domain}}:{{impulse-port}}/private/{{adapter-name}}/config' \
--header 'Content-Type: application/json' \
--data-raw '{
  "endPointID": "{{endpoint-id}}",
  "taxiPickupURL": "http://taxi-pickup-app:8080",
  "taxiDropoffURL": "http://taxi-dropoff-app:8080",
  "properties": {
    "dbUser": "dotcmsdbuser",
    "dbPassword": "password",
    "dbConnectionURL": "postgres://source-dotcms-db:5432/dotcms",
    "assetsPath": "/data/shared/assets",
    "defaultLanguageCode": "en",
    "defaultCountryCode": "US",
    "defaultHostStructure": "855a2d72-f2f3-4169-8b04-ac5157c4380c"
  }
}'
```

This same request can be used to update the adapter config. To update the config use the same `endPointId` in the request. This will update any existing config with that endpoint ID or create a new config if one does not exist.&#x20;

### Taxi Pickup Config

Once an endpoint is created and you have it's ID, you need to save config to connect to your chosen connector. The taxi pickup config is required for source connectors. These are connectors with either level 2 or level 3. If you are using the endpoint as a source you must save taxi pickup config. The config is required to sync content from the repository or for full Impulse capabilities, such as diff reporting. Without this config, the content will not be picked up and saved into Impulse.

Based on which connector you have chosen, you will use a different value in the [payload of the config](https://documenter.getpostman.com/view/12031716/UVsSP4EP?version=latest#93c6654a-95d9-41bd-ab32-879a1d756c53). For this example we will use the dotCMS source connector. The example request would look like the following.&#x20;

```
curl --request PUT '{{impulse-protocol}}://{{impulse-domain}}:{{impulse-port}}/private/taxi-pickup/config/{{endpoint-id}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "AdapterURL" : "http://{{relative-dotcms-adapter-read-domain}}:8080"
}'
```

The `AdapterURL` is the relative URL to the connector's read adapter.&#x20;

## Destination Connector Config

### Adapter Write Config

Once an endpoint is created and you have it's ID, you need to save config to connect to your chosen repository. The adapter write config is only available for connectors level 1 or level 3. The config is required to sync content to the repository. Without this config, the content will not be saved to a destination repository.&#x20;

Based on which connector you want to use for the endpoint you will use a different config API. View the specific [connectors user doc](/impulse-user-manual/connectors.md) and [API doc](https://documenter.getpostman.com/view/12031716/UVsSP4EP?version=latest#8e9d5d54-6a99-47dd-b197-2115a74b22c3) for more information. For this example we will use the dotCMS destination connector. As such you will need to create the config payload. All connectors configs have few matching attributes.&#x20;

* `endPointId`
  * The endpoint ID of the associated endpoint
* `taxiPickupURL`
  * The **relative** URL of the pickup taxi
  * Public Impulse uses the value: `http://taxi-pickup-app:8080`
* `taxiDropoffURL`
  * The **relative** URL of the drop off taxi
  * Public Impulse uses the value: `http://taxi-`dropoff`-app:8080`

The dotCMS adapter has specific properties that are listed in both the [API doc](https://documenter.getpostman.com/view/12031716/UVsSP4EP?version=latest#e7bb5e2e-98ca-4b5a-81b4-86458b132fdc) and the [dotCMS source connector doc](/impulse-user-manual/connectors/destination-connectors/dotcms.md).&#x20;

Making the example request:&#x20;

```
curl --request PUT '{{impulse-protocol}}://{{impulse-domain}}:{{impulse-port}}/private/{{adapter-name}}/config' \
--header 'Content-Type: application/json' \
--data-raw '{
  "endPointID": "{{endpoint-id}}",
  "taxiPickupURL": "http://taxi-pickup-app:8080",
  "taxiDropoffURL": "http://taxi-dropoff-app:8080",
  "properties": {
    "dbUser": "dotcmsdbuser",
    "dbPassword": "password",
    "dbConnectionURL": "postgres://dest-dotcms-db:5432/dotcms",
    "assetsPath": "/data/shared/assets",
    "defaultLanguageCode": "en",
    "defaultCountryCode": "US",
    "defaultHostStructure": "855a2d72-f2f3-4169-8b04-ac5157c4380c"
  }
}'
```

This same request can be used to update the adapter config. To update the config use the same `endPointId` in the request. This will update any existing config with that endpoint ID or create a new config if one does not exist.&#x20;

### Taxi Drop-off Config

Once an endpoint is created and you have it's ID, you need to save config to connect to your chosen connector. The taxi drop off config is required for destination connectors. These are connectors with either level 1 or level 3. If you are using the endpoint as a destination you must save taxi drop off config. Without this config, the content will not be saved to a repository.

Based on which connector you have chosen, you will use a different value in the [payload of the config](https://documenter.getpostman.com/view/12031716/UVsSP4EP?version=latest#93c6654a-95d9-41bd-ab32-879a1d756c53). For this example we will use the dotCMS destination connector. The example request would look like the following.&#x20;

```
curl --request PUT '{{impulse-protocol}}://{{impulse-domain}}:{{impulse-port}}/private/taxi-pickup/config/{{endpoint-id}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "AdapterURL" : "http://{{relative-dotcms-adapter-write-domain}}:8080"
}'
```

The `AdapterURL` is the relative URL to the connector's write adapter.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://motivlabs.gitbook.io/impulse-user-manual/using-impulse-headlessly/getting-started-with-curl/first-endpoint.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
