Providing HTTP query parameters
HTTP requests can be set to contain request parameters, which are encoded at the end of the URL in the following form:
/path?key=value&key=value
The request parameters are decoded and added to the metadata.http.queryString map as key-value pairs. The parameters can either be mapped to a dictionary field in an event, or a specific named parameter can be mapped to a single field. For example:
- mapperCodec:
Request:
towardsHost:
mapFrom:
# set one query parameter individually
- payload.paramValue: metadata.http.queryString.param
# alternatively set all query parameters in an EPL dictionary
- payload.parameters: metadata.http.queryString
The
metadata.http.queryString field is only set in the request when the query string is not empty. If you wish to map the query string to an event field and there is a chance it could be empty, add a
defaultValue for it in your
mapperCodec rules. See also
The Mapper codec connectivity plug-in.