BigBug
BigBug

Reputation: 6290

NiFi Dynamically create requests for InvokeHTTP

New to NiFi!

I have a scenario where I make one rest request and get some data back. The data I receive contains an ID which I need to make subsequent requests. So for example:

InvokeHTTP GET request:

  1. http://localhost:2999/names

result:

[
    {
        id: 123
    },
    {
        id: 345
    }
]

InvokeHTTP GET Request:

  1. http://localhost:2999/id/123/rest/of/url
  2. http://localhost:2999/id/345/rest/of/url

Is there a way for me to assemble the two requests above to pass to InvokeHTTP in NiFi?

Thanks in advance!

Upvotes: 4

Views: 2382

Answers (1)

Andy
Andy

Reputation: 14194

If the response is in JSON, you probably want to use SplitJson to split the array into separate flowfiles, then use EvaluateJSONPath to extract the id values into flowfile attributes (one per flowfile). From there, you can feed those flowfiles into another InvokeHTTP processor and reference the relevant attribute values.

Upvotes: 6

Related Questions