- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
handling multiple values for a same parameter in handlehttprequest processor
- Labels:
-
Apache NiFi
Created on ‎07-26-2018 08:46 AM - edited ‎08-17-2019 10:52 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All,
I am using combination of Handlehttprequest and Handlehttpresponse processors to get the rest end point to the client application.
I have issues with the below type of curl post request. Handlehttprequest is not creating the array of parameters and is just keeping last value of the parameter values.
eg:
curl -L -X POST "http://url:port/data?sn=GH6747246T4JLR6AZ&c=QUERY_RECORD&p=test_station_name&p=station_id&p=result&p=mac_addresss"
When I look at the data provenance I see that under attribute values :
I see http.param.p holding only the first value(test_station_name) and
http.query.param.p holding only the last value (mac_address)
Is there way to make this hold array of all the values for the parameter p?
Other way I thought is of using http.query.string which has all the parameter passed and use JoltJSONTRansform to transform the required inputs for me. But JoltJSONTransform spec for achieving this seems to be little tricky.
ANy help is greatly appreciated.
Thanks,
Vish
Created ‎07-26-2018 05:46 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Currently the processor(s) do a simple "put" of the value into the attribute whose name is the same as the parameter key. Previous encounters with a parameter of the same name will be overwritten, which is why you're seeing . I have written up an Improvement Jira (NIFI-5467) to let the user choose to allow multiple params with the same key, and create a comma-separated list when multiple params are encountered.
As a workaround you can parse the http.query.string using the same technique with which I answered your related question, using a script to parse the string and create an array of values for the multiple-valued param.
Created ‎07-26-2018 05:46 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Currently the processor(s) do a simple "put" of the value into the attribute whose name is the same as the parameter key. Previous encounters with a parameter of the same name will be overwritten, which is why you're seeing . I have written up an Improvement Jira (NIFI-5467) to let the user choose to allow multiple params with the same key, and create a comma-separated list when multiple params are encountered.
As a workaround you can parse the http.query.string using the same technique with which I answered your related question, using a script to parse the string and create an array of values for the multiple-valued param.
Created ‎07-27-2018 04:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot @Matt Burgess for the details on the current limitations and the Jira. I would look at the solution provided by you on the other thread. Appreciate your help on the same.
Regards,
Vish
