/
HTTP requester

HTTP requester

Component to send (parts of) the document to any service running via HTTP. This component supports the HTTP GET and POST methods and can substitute parts of the document into the url called (if requred).

In GET mode, no request body is sent, but values from the document may be substituted into the url called.

In POST mode, the entire record document is sent in the body of the HTTP request. Values from the document may be substituted into the url called.

Configuration

Example configuration in a processor:

{
  "servers" : [
    {
      "host" : "service-host",
      "port" : 8000,
      "path": "server/specific/endpoint"
    }
  ],
  "method": "GET",
  "endpoint": "server/non-specific/endpoint",
  "query": "paramA=${/a}&paramB=${/b}&paramD=${/c/d}",
  "outputField": "response",
  "ignoreDeletes": true,
  "connectTimeout": "10s",
  "readTimeout": "1m",
  "name" : "HTTP requester",
  "type" : "http-requester",
  "id" : "c1f9f0b2-b999-44ea-acd6-0020be2fb2d7"
}

Configuration parameters:

servers.host

(Required, String) The hostname of the server on which the service running.

servers.port

(Required, Int) The port on the server on which the service is running.

servers.path

(Optional, String) An endpoint for the service (specific this particular server).

method

(Optional, String) The HTTP method to use for the request to the service. Supports GET and POST. Defaults to GET.

  • In GET mode, no body is sent in the HTTP request.
  • In POST mode, the entire record document is sent in the body of the HTTP request

endpoint

(Optional, String) An endpoint for the service. The URL the component calls is constructed from both the servers.path and the endpoint configuration, allowing for a common endpoint to be used for all servers (by only supplying endpoint) or a server specific endpoint (by only supplying servers.path) to be used. Both servers.path and endpoint may be supplied to give a server specific endpoint that includes a common piece.

The endpoint can include substitutions using the manner described in query below.

query

(Optional, String) An set of query parameters for the endpoint. The string may contain variables to substitute with environment variables, system properties or values from the record's document.

e.g

{
  "query": "paramA=${/a}&paramB=${/b}&paramD=${/c/d}"
}

will replace ${/a}, ${/b} and ${/c/d} with the values from those json paths (/a, /b and /c/d) taken from the record's document.

{
  "query": "paramA=${variable}"
}

will replace ${variable} with the value of the node named variable in the root of the record's document. If that does not exist, then the substitution will be attempted from a system property or environment variable (in that order).

If non value is found, the substitution will not be performed and the ${variable} will remain in the query parameters.

outputField

(Optional, String) The name of the field to which the response from the service will be written. Defaults to response.

connectTimeout

(Optional, Duration) connect timeout for calls made to the service, expressed as a duration. Default 15s

readTimeout

(Optional, Duration) read timeout for calls made to the service, expressed as a duration. Default 1m

©2024 Pureinsights Technology Corporation