Support Questions

Find answers, ask questions, and share your expertise

handling multiple values for a same parameter in handlehttprequest processor

avatar
Explorer

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

83440-handlehttprequest.jpg

1 ACCEPTED SOLUTION

avatar
Master Guru

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.

View solution in original post

2 REPLIES 2

avatar
Master Guru

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.

avatar
Explorer

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