# Http Sink Templating

## Static string template  <a href="#static-string-template" id="static-string-template"></a>

In this case the converters are irrelevant as we are not using the message content to populate our message template.

```properties
connector.class=io.lenses.streamreactor.connect.http.sink.HttpSinkConnector
topics=mytopic
tasks.max=1
connect.http.config={"method":"Post","endpoint":"https://my-endpoint.example.com","content":"My Static Content Template","batch":{"batchCount":1}}
```

## Dynamic string template  <a href="#dynamic-string-template" id="dynamic-string-template"></a>

The HTTP request body contains the value of the message, which is retained as a string value via the StringConverter.

```properties
connector.class=io.lenses.streamreactor.connect.http.sink.HttpSinkConnector
topics=mytopic
tasks.max=1
connect.http.config={"method":"Post","endpoint":"https://my-endpoint.example.com","content":"{{value}}","batch":{"batchCount":1}}
key.converter=org.apache.kafka.connect.storage.StringConverter
value.converter=org.apache.kafka.connect.storage.StringConverter
```

## Dynamic string template containing json message fields  <a href="#dynamic-string-template-containing-json-message-fields" id="dynamic-string-template-containing-json-message-fields"></a>

Specific fields from the JSON message are substituted into the HTTP request body alongside some static content.

```properties
connector.class=io.lenses.streamreactor.connect.http.sink.HttpSinkConnector
topics=mytopic
tasks.max=1
key.converter=org.apache.kafka.connect.storage.StringConverter
value.converter=org.apache.kafka.connect.json.JsonConverter
connect.http.config={"method":"Post","endpoint":"https://my-endpoint.example.com","content":"product: {{value.product}},"batch":{"batchSize":1}}
value.converter.schemas.enable=false
```

## Dynamic string template containing whole json message  <a href="#dynamic-string-template-containing-whole-json-message" id="dynamic-string-template-containing-whole-json-message"></a>

The entirety of the message value is substituted into a placeholder in the message body. The message is treated as a string via the StringConverter.

```properties
connector.class=io.lenses.streamreactor.connect.http.sink.HttpSinkConnector
topics=mytopic
tasks.max=1
key.converter=org.apache.kafka.connect.storage.StringConverter
value.converter=org.apache.kafka.connect.storage.StringConverter
connect.http.config={"method":"Post","endpoint":"https://my-endpoint.example.com","content":"whole product message: {{value}}","batch":{"timeInterval":5}}
```

## Dynamic string template containing avro message fields  <a href="#dynamic-string-template-containing-avro-message-fields" id="dynamic-string-template-containing-avro-message-fields"></a>

Fields from the AVRO message are substituted into the message body in the following example:

```properties
connector.class=io.lenses.streamreactor.connect.http.sink.HttpSinkConnector
topics=mytopic
tasks.max=1
connect.http.config={"method":"Post","endpoint":"https://my-endpoint.example.com","content":"product: {{value.product}}"}
key.converter=org.apache.kafka.connect.storage.StringConverter
value.converter=io.confluent.connect.avro.AvroConverter
value.converter.schemas.enable=true
value.converter.schema.registry.url=http://schema-registry:8081
```
