HTTP Connector

In Camunda Connect a Connectors class exists which automatically detects every connector in the classpath. It can be used to get the HTTP connector instance by its connector ID, which is http-connector.

HttpConnector http = Connectors.getConnector(HttpConnector.ID);

Configure Apache HTTP Client

Camunda Connect HTTP client uses the Apache HTTP client to make HTTP requests. Accordingly, it supports the same configuration options.

Default Configuration

By default, the HTTP client uses Apache’s default configuration and respects the system properties that are supported by HTTP client.

Custom Configuration

If you want to reconfigure the client going beyond the default configuration options, e.g. you want to configure another connection manager, the easiest way is to register a new connector configurator.

package org.camunda.connect.example;

import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.camunda.connect.httpclient.impl.AbstractHttpConnector;
import org.camunda.connect.spi.ConnectorConfigurator;

public class HttpConnectorConfigurator implements ConnectorConfigurator<HttpConnector> {

  public Class<HttpConnector> getConnectorClass() {
    return HttpConnector.class;

  public void configure(HttpConnector connector) {
    CloseableHttpClient client = HttpClients.custom()
    ((AbstractHttpConnector) connector).setHttpClient(client);


To enable auto detection of your new configurator please add a file called org.camunda.connect.spi.ConnectorConfigurator to your resources/META-INF/services directory with class name as content. For more information see the extending Connect section.



Create a Simple HTTP Request

The HTTP connector can be used to create a new request, set a HTTP method, URL, content type and payload.

A simple GET request:


A POST request with a content type and payload set:

  .payload("Hello World!")

The HTTP methods PUT, DELETE, PATCH, HEAD, OPTIONS, TRACE are also available.

Adding HTTP Headers to a Request

To add own headers to the HTTP request the method header is available.

HttpResponse response = http.createRequest()
  .header("Accept", "application/json")

Using the Generic API

Besides the configuration methods also a generic API exists to set parameters of a request. The following parameters are available:

Parameter Description
method Sets the HTTP method of the request
url Sets the URL of the request
headers Contains a map of the configured HTTP headers of the request
payload Sets the payload of the request

This can be used as follows:

HttpRequest request = http.createRequest();
request.setRequestParameter("method", "GET");
request.setRequestParameter("url", "");
request.setRequestParameter("payload", "hello world!");


A response contains the status code, response headers and body.

Integer statusCode = response.getStatusCode();
String contentTypeHeader = response.getHeader("Content-Type");
String body = response.getResponse();

After the response was processed it should be closed.


Using the Generic API

Besides the response methods a generic API is provided to gather the response parameters. The following parameters are available:

Parameter Description
statusCode Contains the status code of the response
headers Contains a map with the HTTP headers of the response
response Contains the response body

This can be used as follows:


On this Page: