Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How to Extract query param from nifi

avatar
Expert Contributor

Hi,

I had been automate get request based on user query param using nifi with help of InvokeHttp.Here is the example;

http://aaa.com/q="bigdata"&api_key=""

http://aaa.com/q="apple"&api_key=""

I did split text using line by line read and invoke http processor using fetch those response as json format. My question is before invokehttp processor, i want to extract those query param values those query values are static. I need to know which query param using i got response. Please give me some suggestion. It would much helpful.

Thanks.

1 ACCEPTED SOLUTION

avatar
Master Guru

@Varun R

After split text processor use extract text processor and add new property with matching regex, then the extracted attribute will be added as the flowfile attribute.

Example:-

After split text you are having each address in a flowfile as like this http://aaa.com/q="bigdata"≈i_key="", now you want to know which query param value(ex:bigdata) has been used.

Then use extract text add new property

query_values

q="(.*?)"

60420-extracttext.png

output flowfile:-

60421-queryparam.png

Once the flowfile processed by extract text processor it matches the regex and adds the attribute query_values to the flowfile.

By this way you are going to know which query param values are used to get response.

.

If the Answer helped to resolve your issue, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of issues.

View solution in original post

1 REPLY 1

avatar
Master Guru

@Varun R

After split text processor use extract text processor and add new property with matching regex, then the extracted attribute will be added as the flowfile attribute.

Example:-

After split text you are having each address in a flowfile as like this http://aaa.com/q="bigdata"≈i_key="", now you want to know which query param value(ex:bigdata) has been used.

Then use extract text add new property

query_values

q="(.*?)"

60420-extracttext.png

output flowfile:-

60421-queryparam.png

Once the flowfile processed by extract text processor it matches the regex and adds the attribute query_values to the flowfile.

By this way you are going to know which query param values are used to get response.

.

If the Answer helped to resolve your issue, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of issues.