# 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
```


---

# 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://docs.lenses.io/latest/connectors/tutorials/http-sink-templating.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.
