RestLookupService 2.0.0

Bundle
org.apache.nifi | nifi-lookup-services-nar
Description
Use a REST service to look up values.
Tags
http, json, lookup, rest, xml
Input Requirement
Supports Sensitive Dynamic Properties
true
  • Additional Details for RestLookupService 2.0.0

    RestLookupService

    General

    This lookup service has the following optional lookup coordinate keys:

    • request.method; defaults to ‘get’, valid values:
      • delete
      • get
      • post
      • put
    • request.body; contains a string representing JSON, XML, etc. to be sent with any of those methods except for “get”.
    • mime.type; specifies media type of the request body, required when ‘body’ is passed.
    • *; any other keys can be configured to pass variables to resolve target URLs. See ‘Dynamic URLs’ section below.

    The record reader is used to consume the response of the REST service call and turn it into one or more records. The record path property is provided to allow for a lookup path to either a nested record or a single point deep in the REST response. Note: a valid schema must be built that encapsulates the REST response accurately in order for this service to work.

    Headers

    Headers are supported using dynamic properties. Just add a dynamic property and the name will be the header name and the value will be the value for the header. Expression language powered by input from the variable registry is supported.

    Dynamic URLs

    The URL property supports expression language through the lookup key/value pairs configured on the component using this lookup service (e.g. LookupRecord processor). The configuration specified by the user will be passed through to the expression language engine for evaluation. Note: flowfile attributes will be disregarded here for this property.

    Ex. URL: http://example.com/service/${user.name}/friend/${friend.id}, combined with example record paths at LookupRecord processor:

    • user.name => “/example/username”
    • friend.id => “/example/first_friend”

    Would dynamically produce an endpoint of http://example.com/service/john.smith/friend/12345

    Using Environment Properties with URLs

    In addition to the lookup key/value pairs, environment properties / system variables can be referred from expression languages configured at the URL property.

    Ex. URL: http://${apiServerHostname}:${apiServerPort}/service/${user.name}/friend/${friend.id}, combined with the previous example record paths, and environment properties:

    • apiServerHostname => “test.example.com”
    • apiServerPort => “8080”

    Would dynamically produce an endpoint of http://test.example.com:8080/service/john.smith/friend/12345

Properties
Dynamic Properties