HTTP client module allows to make HTTP calls
To use this module, you must import it to your DataWeave code, for example,
by adding the line import * from dw::io::http::Client to the header of your
DataWeave script.
| Name | Description |
|---|---|
| connect | Helper function to send a CONNECT HTTP request. |
| createAuthorizationHeader | Utility function that adds the proper Authorization header based on the supported Auth type. |
| createBinaryHttpRequest | Helper function to create a HttpRequest instances with Binary request body. |
| createHttpRequest | Helper function to create an HttpRequest instance. |
| delete | Helper function to send a DELETE HTTP request. |
| get | Helper function to send a GET HTTP request. |
| head | Helper function to send a HEAD HTTP request. |
| options | Helper function to send a OPTIONS HTTP request. |
| patch | Helper function to send a PATCH HTTP request. |
| post | Helper function to send a POST HTTP request. |
| postMultipart | Helper function to send a multipart HTTP request. |
| put | Helper function to send a PUT HTTP request. |
| readBody | Helper function to read a Binary body instance. |
| readHttpResponseBody | Helper function to read a HttpResponse with a Binary body instance. |
| resolveTemplateWith | Replace the templates of a url according to RFC6570 |
| sendRequest | Sends an HTTP request by using the provided binaryRequestEncoder to convert the current request into an HttpRequest<Binary,H> instancewith the desired configurations (request/client configuration) and returns an HTTP response using the provided binaryResponseDecoder to convertthe current HTTP response into an HttpResponse<B, H>> instance. |
| sendRequestAndReadResponse | Sends an HTTP request by writing the request body into a Binary instance and readingthe HTTP response Binary body instance. |
| trace | Helper function to send a TRACE HTTP request. |
| url | String interpolator function to build a URL |
| Name | Description |
|---|---|
| DEFAULT_HTTP_CLIENT_CONFIG | Variable used to identify the default HTTP client configuration. |
| DEFAULT_HTTP_REQUEST_CONFIG | Variable used to identify the default HTTP request configuration. |
| DEFAULT_SERIALIZATION_CONFIG | Variable used to identify the default HTTP serialization configuration. |
connect<B <: HttpBody, H <: HttpHeaders>(url: String | UrlBuilder, headers: HttpHeaders = {}, requestConfig: HttpRequestConfig = DEFAULT_HTTP_REQUEST_CONFIG, serializationConfig: SerializationConfig = DEFAULT_SERIALIZATION_CONFIG, clientConfig: HttpClientConfig = DEFAULT_HTTP_CLIENT_CONFIG): HttpResponse<B, H>
Helper function to send a CONNECT HTTP request.
| Name | Type | Description |
|---|---|---|
| url | String | UrlBuilder |
The desired HTTP request url. |
| headers | HttpHeaders |
The HTTP request header to send. |
| requestConfig | HttpRequestConfig |
The HTTP request configuration to use. |
| serializationConfig | SerializationConfig |
The HTTP serialization configuration to use. |
| clientConfig | HttpClientConfig |
The HTTP client configuration configuration to use. |
Utility function that adds the proper Authorization header based on the supported Auth type.
createBinaryHttpRequest(request: HttpRequest, serializationConfig: SerializationConfig): HttpRequest<Binary>
Helper function to create a HttpRequest instances with Binary request body.
| Name | Type | Description |
|---|---|---|
| request | HttpRequest |
The desired HTTP request to convert to a HttpRequest instances with Binary request body. |
| serializationConfig | SerializationConfig |
The HTTP serialization configuration to use. |
createHttpRequest<T <: HttpBody>(method: HttpMethod, url: String | UrlBuilder, headers: HttpHeaders = {}, body: T | Null = null, cookies: HttpRequestCookies = {}): HttpRequest<T>
Helper function to create an HttpRequest instance.
| Name | Type | Description |
|---|---|---|
| method | HttpMethod |
The desired HTTP request method. |
| url | String | UrlBuilder |
The desired HTTP request url. |
| headers | HttpHeaders |
The HTTP request header to send. |
| cookies | HttpRequestCookies |
The HTTP request cookies to send. |
| body | HttpBody | Null |
The HTTP request body to send. |
delete<B <: HttpBody, H <: HttpHeaders>(url: String | UrlBuilder, headers: HttpHeaders = {}, body: HttpBody | Null = null, requestConfig: HttpRequestConfig = DEFAULT_HTTP_REQUEST_CONFIG, serializationConfig: SerializationConfig = DEFAULT_SERIALIZATION_CONFIG, clientConfig: HttpClientConfig = DEFAULT_HTTP_CLIENT_CONFIG): HttpResponse<B, H>
Helper function to send a DELETE HTTP request.
| Name | Type | Description |
|---|---|---|
| url | String | UrlBuilder |
The desired HTTP request url. |
| headers | HttpHeaders |
The HTTP request header to send. |
| body | HttpBody | Null |
The HTTP request body to send. |
| requestConfig | HttpRequestConfig |
The HTTP request configuration to use. |
| serializationConfig | SerializationConfig |
The HTTP serialization configuration to use. |
| clientConfig | HttpClientConfig |
The HTTP client configuration configuration to use. |
get<B <: HttpBody, H <: HttpHeaders>(url: String | UrlBuilder, headers: HttpHeaders = {}, requestConfig: HttpRequestConfig = DEFAULT_HTTP_REQUEST_CONFIG, serializationConfig: SerializationConfig = DEFAULT_SERIALIZATION_CONFIG, clientConfig: HttpClientConfig = DEFAULT_HTTP_CLIENT_CONFIG): HttpResponse<B, H>
Helper function to send a GET HTTP request.
| Name | Type | Description |
|---|---|---|
| url | String | UrlBuilder |
The desired HTTP request url. |
| headers | HttpHeaders |
The HTTP request header to send. |
| requestConfig | HttpRequestConfig |
The HTTP request configuration to use. |
| serializationConfig | SerializationConfig |
The HTTP serialization configuration to use. |
| clientConfig | HttpClientConfig |
The HTTP client configuration configuration to use. |
head<B <: HttpBody, H <: HttpHeaders>(url: String | UrlBuilder, headers: HttpHeaders = {}, requestConfig: HttpRequestConfig = DEFAULT_HTTP_REQUEST_CONFIG, serializationConfig: SerializationConfig = DEFAULT_SERIALIZATION_CONFIG, clientConfig: HttpClientConfig = DEFAULT_HTTP_CLIENT_CONFIG): HttpResponse<B, H>
Helper function to send a HEAD HTTP request.
| Name | Type | Description |
|---|---|---|
| url | String | UrlBuilder |
The desired HTTP request url. |
| headers | HttpHeaders |
The HTTP request header to send. |
| requestConfig | HttpRequestConfig |
The HTTP request configuration to use. |
| serializationConfig | SerializationConfig |
The HTTP serialization configuration to use. |
| clientConfig | HttpClientConfig |
The HTTP client configuration configuration to use. |
options<B <: HttpBody, H <: HttpHeaders>(url: String | UrlBuilder, headers: HttpHeaders = {}, requestConfig: HttpRequestConfig = DEFAULT_HTTP_REQUEST_CONFIG, serializationConfig: SerializationConfig = DEFAULT_SERIALIZATION_CONFIG, clientConfig: HttpClientConfig = DEFAULT_HTTP_CLIENT_CONFIG): HttpResponse<B, H>
Helper function to send a OPTIONS HTTP request.
| Name | Type | Description |
|---|---|---|
| url | String | UrlBuilder |
The desired HTTP request url. |
| headers | HttpHeaders |
The HTTP request header to send. |
| requestConfig | HttpRequestConfig |
The HTTP request configuration to use. |
| serializationConfig | SerializationConfig |
The HTTP serialization configuration to use. |
| clientConfig | HttpClientConfig |
The HTTP client configuration configuration to use. |
patch<B <: HttpBody, H <: HttpHeaders>(url: String | UrlBuilder, headers: HttpHeaders = {}, body: HttpBody | Null = null, requestConfig: HttpRequestConfig = DEFAULT_HTTP_REQUEST_CONFIG, serializationConfig: SerializationConfig = DEFAULT_SERIALIZATION_CONFIG, clientConfig: HttpClientConfig = DEFAULT_HTTP_CLIENT_CONFIG): HttpResponse<B, H>
Helper function to send a PATCH HTTP request.
| Name | Type | Description |
|---|---|---|
| url | String | UrlBuilder |
The desired HTTP request url. |
| headers | HttpHeaders |
The HTTP request header to send. |
| body | HttpBody | Null |
The HTTP request body to send. |
| requestConfig | HttpRequestConfig |
The HTTP request configuration to use. |
| serializationConfig | SerializationConfig |
The HTTP serialization configuration to use. |
| clientConfig | HttpClientConfig |
The HTTP client configuration configuration to use. |
post<B <: HttpBody, H <: HttpHeaders>(url: String | UrlBuilder, headers: HttpHeaders = {}, body: HttpBody | Null = null, requestConfig: HttpRequestConfig = DEFAULT_HTTP_REQUEST_CONFIG, serializationConfig: SerializationConfig = DEFAULT_SERIALIZATION_CONFIG, clientConfig: HttpClientConfig = DEFAULT_HTTP_CLIENT_CONFIG): HttpResponse<B, H>
Helper function to send a POST HTTP request.
| Name | Type | Description |
|---|---|---|
| url | String | UrlBuilder |
The desired HTTP request url. |
| headers | HttpHeaders |
The HTTP request header to send. |
| body | HttpBody | Null |
The HTTP request body to send. |
| requestConfig | HttpRequestConfig |
The HTTP request configuration to use. |
| serializationConfig | SerializationConfig |
The HTTP serialization configuration to use. |
| clientConfig | HttpClientConfig |
The HTTP client configuration configuration to use. |
postMultipart<B <: HttpBody, H <: HttpHeaders>(url: String | UrlBuilder, body: Multipart, headers: HttpHeaders = {}, requestConfig: HttpRequestConfig = DEFAULT_HTTP_REQUEST_CONFIG, serializationConfig: SerializationConfig = DEFAULT_SERIALIZATION_CONFIG, clientConfig: HttpClientConfig = DEFAULT_HTTP_CLIENT_CONFIG): HttpResponse<B, H>
Helper function to send a multipart HTTP request.
| Name | Type | Description |
|---|---|---|
| url | String | UrlBuilder |
The desired HTTP request url. |
| body | Multipart |
The HTTP request body to send. |
| headers | HttpHeaders |
The HTTP request header to send. |
| requestConfig | HttpRequestConfig |
The HTTP request configuration to use. |
| serializationConfig | SerializationConfig |
The HTTP serialization configuration to use. |
| clientConfig | HttpClientConfig |
The HTTP client configuration configuration to use. |
put<B <: HttpBody, H <: HttpHeaders>(url: String | UrlBuilder, headers: HttpHeaders = {}, body: HttpBody | Null = null, requestConfig: HttpRequestConfig = DEFAULT_HTTP_REQUEST_CONFIG, serializationConfig: SerializationConfig = DEFAULT_SERIALIZATION_CONFIG, clientConfig: HttpClientConfig = DEFAULT_HTTP_CLIENT_CONFIG): HttpResponse<B, H>
Helper function to send a PUT HTTP request.
| Name | Type | Description |
|---|---|---|
| url | String | UrlBuilder |
The desired HTTP request url. |
| headers | HttpHeaders |
The HTTP request header to send. |
| body | HttpBody | Null |
The HTTP request body to send. |
| requestConfig | HttpRequestConfig |
The HTTP request configuration to use. |
| serializationConfig | SerializationConfig |
The HTTP serialization configuration to use. |
| clientConfig | HttpClientConfig |
The HTTP client configuration configuration to use. |
Helper function to read a Binary body instance.
| Name | Type | Description |
|---|---|---|
| mimeType | String |
The MIME type to use. |
| body | Binary |
The desired body parse. |
| readerProperties | Object |
The reader configuration properties used for read the body. |
readHttpResponseBody<B <: HttpBody, H <: HttpHeaders>(httpResponse: HttpResponse<Binary, H>, serializationConfig: SerializationConfig): HttpResponse<B, H>
Helper function to read a HttpResponse with a Binary body instance.
| Name | Type | Description |
|---|---|---|
| httpResponse | HttpResponse<Binary,H> |
The desired HttpResponse to parse. |
| serializationConfig | SerializationConfig |
The HTTP serialization configuration to use. |
Replace the templates of a url according to RFC6570
sendRequest<B <: HttpBody, H <: HttpHeaders>(request: HttpRequest, binaryRequestEncoder: BinaryRequestEncoder, binaryResponseDecoder: BinaryResponseDecoder<B, H>, requestConfig: HttpRequestConfig = DEFAULT_HTTP_REQUEST_CONFIG, clientConfig: HttpClientConfig = DEFAULT_HTTP_CLIENT_CONFIG): HttpResponse<B, H>
Sends an HTTP request by using the provided binaryRequestEncoder to convert the current request into an HttpRequest<Binary,H> instance
with the desired configurations (request/client configuration) and returns an HTTP response using the provided binaryResponseDecoder to convert
the current HTTP response into an HttpResponse<B, H>> instance.
| Name | Type | Description |
|---|---|---|
| request | HttpRequest |
An HTTP request to send. |
| binaryRequestEncoder | BinaryRequestEncoder |
The HTTP request encoder to use. |
| binaryResponseDecoder | BinaryResponseDecoder |
The HTTP response decoder to use. |
| requestConfig | HttpRequestConfig |
The HTTP request configuration to use. |
| clientConfig | HttpClientConfig |
The HTTP client configuration configuration to use. |
sendRequest<B <: HttpBody, H <: HttpHeaders>(request: HttpRequest<Binary>, binaryResponseDecoder: BinaryResponseDecoder<B, H>, requestConfig: HttpRequestConfig = DEFAULT_HTTP_REQUEST_CONFIG, clientConfig: HttpClientConfig = DEFAULT_HTTP_CLIENT_CONFIG): HttpResponse<B, H>
Sends an HttpRequest<Binary,H> instance with the desired configurations (request/client configuration)
and returns an HTTP response using the provided binaryResponseDecoder to convert the current HTTP response
into an HttpResponse<B, H>> instance.
| Name | Type | Description |
|---|---|---|
| request | HttpRequest<Binary,H> |
An HTTP request to send. |
| binaryResponseDecoder | BinaryResponseDecoder |
The HTTP response decoder to use. |
| requestConfig | HttpRequestConfig |
The HTTP request configuration to use. |
| clientConfig | HttpClientConfig |
The HTTP client configuration configuration to use. |
sendRequest<H <: HttpHeaders>(request: HttpRequest, binaryRequestEncoder: BinaryRequestEncoder, requestConfig: HttpRequestConfig = DEFAULT_HTTP_REQUEST_CONFIG, clientConfig: HttpClientConfig = DEFAULT_HTTP_CLIENT_CONFIG): HttpResponse<Binary, H>
Sends an HTTP request by using the provided binaryRequestEncoder to convert the current request into an HttpRequest<Binary,H> instance
with the desired configurations (request/client configuration) and returns an HttpResponse<Binary, H>> instance.
| Name | Type | Description |
|---|---|---|
| request | HttpRequest |
An HTTP request to send. |
| binaryRequestEncoder | BinaryRequestEncoder |
The HTTP request encoder to use. |
| requestConfig | HttpRequestConfig |
The HTTP request configuration to use. |
| clientConfig | HttpClientConfig |
The HTTP client configuration configuration to use. |
sendRequest<H <: HttpHeaders>(request: HttpRequest<Binary>, requestConfig: HttpRequestConfig = DEFAULT_HTTP_REQUEST_CONFIG, clientConfig: HttpClientConfig = DEFAULT_HTTP_CLIENT_CONFIG): HttpResponse<Binary, H>
Sends an HTTP request with a Binary body instance with the desired configurations (request/client configuration)
and returns an HttpResponse<Binary, H>> instance.
| Name | Type | Description |
|---|---|---|
| request | HttpRequest<Binary,H> |
An HTTP request to send. |
| requestConfig | HttpRequestConfig |
The HTTP request configuration to use. |
| clientConfig | HttpClientConfig |
The HTTP client configuration configuration to use. |
sendRequestAndReadResponse<B <: HttpBody, H <: HttpHeaders>(request: HttpRequest, requestConfig: HttpRequestConfig = DEFAULT_HTTP_REQUEST_CONFIG, serializationConfig: SerializationConfig = DEFAULT_SERIALIZATION_CONFIG, clientConfig: HttpClientConfig = DEFAULT_HTTP_CLIENT_CONFIG): HttpResponse<B, H>
Sends an HTTP request by writing the request body into a Binary instance and reading
the HTTP response Binary body instance.
| Name | Type | Description |
|---|---|---|
| request | HttpRequest |
An HTTP request to send. |
| requestConfig | HttpRequestConfig |
The HTTP request configuration to use. |
| serializationConfig | SerializationConfig |
The HTTP serialization configuration to use. |
| clientConfig | HttpClientConfig |
The HTTP client configuration configuration to use. |
trace<B <: HttpBody, H <: HttpHeaders>(url: String | UrlBuilder, headers: HttpHeaders = {}, requestConfig: HttpRequestConfig = DEFAULT_HTTP_REQUEST_CONFIG, serializationConfig: SerializationConfig = DEFAULT_SERIALIZATION_CONFIG, clientConfig: HttpClientConfig = DEFAULT_HTTP_CLIENT_CONFIG): HttpResponse<B, H>
Helper function to send a TRACE HTTP request.
| Name | Type | Description |
|---|---|---|
| url | String | UrlBuilder |
The desired HTTP request url. |
| headers | HttpHeaders |
The HTTP request header to send. |
| requestConfig | HttpRequestConfig |
The HTTP request configuration to use. |
| serializationConfig | SerializationConfig |
The HTTP serialization configuration to use. |
| clientConfig | HttpClientConfig |
The HTTP client configuration configuration to use. |
String interpolator function to build a URL
Variable used to identify the default HTTP client configuration.
Variable used to identify the default HTTP request configuration.
Variable used to identify the default HTTP serialization configuration.