HTTP Transformer

Table Of Contents

  • Use case
  • General description
  • The different parts of the HTTP Transformer
  • Video guide

Use case

The function of an HTTP Transformer is to interact with an API end-point with the implementation of an entity transformer. This can be used to collect data from an endpoint based on previously obtained data.

General description

HTTP Transformers are used to interact with web endpoints. It supports standard HTTP request methods that can be used to tell the targeted service what to do.

The most commonly used request methods with the HTTP Transformer are:

GET: The default method to request data from an endpoint.

POST: Sends data to create or add something at the endpoint.

PUT: Generally used to replace existing data on a target endpoint.

DELETE: Removes an entity on the target endpoint.

PATCH: Modifies existing data at the endpoint.

The data that is sent along with the request can be transformed and encoded to match the tailored needs of the targeted web service. Similarly, the data that is received in response to the service can also be decoded and transformed as per requirement.

By default, JSON is used for both request and response data because it is the most common format that web services are encoded in.

If a targeted endpoint is behind a security layer, the Transformer supports ways to add authentication to the requests. The Transformer offers control over parts of the request including the data body, the headers, the endpoint, and the encoding.

The different parts of the HTTP Transformer

  • Request URI
    This is the only required field for the HTTP Transformer. It should contain the URL of the web service that needs to be accessed. For example: http://httpbin.org/json
    The field accepts the usage of placeholders to create dynamic parts in the URL.

  • Request URI encoder
    This helps configure specific encoding for the URL if needed. Based on the standard used in the target web service, certain characters in the request URL need to be encoded in a certain way. The encoder supports the RFC 1738 and the RFC 3986 standards.

  • Request method
    This specifies the type of action that has to be executed on the targeted web service. For example, POST to create an entity or DELETE to remove the entity. While all standard and non-standard HTTP request methods are supported, the default method is GET, which helps request data from given endpoints. The field supports placeholders that can be used to dynamically set the request method.

  • Send payload with DELETE
    By default, DELETE requests do not include a payload. To override this, you can activate the “Send payload with DELETE” checkbox.

  • Plugins
    Plugins are tools that can be used to influence the request or the received response. It is possible to define multiple plugins per request.

  • Authentications
    An authentication for the request can be configured if the targeted web service uses a security layer to prevent unauthorized access. The Transformer supports several popular authentication systems, from basic authentication (username, password) to OAuth 2.0 with specific providers.

  • Payload type
    This is used to configure the data or the body of the message that is sent to the endpoint. The encoded data will usually be the go-to format. It can be converted to several commonly used web formats by using the request encoder. This feature includes support for many payload types.

  • HTTP Client
    This feature helps configure a custom client for specific requirements. This can include, extended logging, custom error handling, or pre-defined authentication methods.

  • Response decoder
    This helps describe how the response to a request is to be handled. By default, it assumes the response contains JSON. If the requested endpoint returns another format than JSON, it can be configured here.

  • Add headers to response body
    If this box is checked, the headers of the received response are added to a specific key in the response body. The response headers will be added to the key “headers” and the response data will be moved to a key named “data”. This can be processed further in other Transformers if needed.

  • Include all items
    This feature helps include all items when the deserializer returns a list.

Video guide