[ 
https://issues.apache.org/jira/browse/NIFI-5214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16483387#comment-16483387
 ] 

ASF GitHub Bot commented on NIFI-5214:
--------------------------------------

Github user ijokarumawak commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2723#discussion_r189754939
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/test/groovy/org/apache/nifi/lookup/RestLookupServiceIT.groovy
 ---
    @@ -106,6 +106,37 @@ class RestLookupServiceIT {
             }
         }
     
    +    @Test
    +    void testHeaders() {
    +        runner.disableControllerService(lookupService)
    +        runner.setProperty(lookupService, "header.X-USER", "jane.doe")
    +        runner.setProperty(lookupService, "header.X-PASS", "testing7890")
    +        runner.enableControllerService(lookupService)
    +
    +        TestServer server = new TestServer()
    +        ServletHandler handler = new ServletHandler()
    +        handler.addServletWithMapping(SimpleJson.class, "/simple")
    +        server.addHandler(handler)
    +        try {
    +            server.startServer()
    +
    +            def coordinates = [
    +                "schema.name": "simple",
    +                "endpoint": server.url + "/simple",
    --- End diff --
    
    In real use-cases, do we expect user to set 'server.url' at a LookupRecord 
processor's user defined property?
    
    As an alternative approach, I'd add `endpoint url` at RestLookupService to 
define a template string to resolve target endpoint, and let callers such as 
LookupRecord to pass required variables to complete the target endpoint.
    
    For example:
    - At RestLookupService
      - Endpoint URL: 
`https://some-api.example.com/buckets/${bucketId}/items/${itemId}`
    - At LookupRecord processor
      - bucketId as user-defined-property: ./bucketId (a record path to get a 
value)
      - itemId as user-defined-property: ./itemId (a record path to get a value)
    
    By doing so, it also supports passing the entire endpoint URL:
    - At RestLookupService
      - Endpoint URL: `${endpoint}`
    - At LookupRecord processor
      - endpoint as user-defined-property: a record path to construct an URL
    
    I'd expect RestLookupService to have more control on REST related 
configurations, and callers just pass variables to make actual requests. How do 
you think?


> Add a REST lookup service
> -------------------------
>
>                 Key: NIFI-5214
>                 URL: https://issues.apache.org/jira/browse/NIFI-5214
>             Project: Apache NiFi
>          Issue Type: New Feature
>            Reporter: Mike Thomsen
>            Assignee: Mike Thomsen
>            Priority: Major
>
> * Should have reader API support
>  * Should be able to drill down through complex XML and JSON responses to a 
> nested record.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to