Hello Igor, The URL property for GetHTTP supports expression language. Check out this function: https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#urlencode
Hope that helps, Joe - - - - - - Joseph Percivall linkedin.com/in/Percivall e: [email protected] On Tuesday, December 15, 2015 4:46 PM, Igor Kravzov <[email protected]> wrote: Hi Joe, Another quick question. How can I encode some part of the URL? Like in example bellow after searchpattern= <http://api.twingly.com/analytics/Analytics.ashx?key=75744154-6ACB-3340-937A-9B5A59FA8F30&searchpattern=boycott&xmloutputversion=2&ts=$%7Bnow():minus(600000):format(> space between Matt Dupe needs to be encoded. Otherwise GetHTTP throws an error. http://api.twingly.com/analytics/Analytics.ashx?key=75744154-6ACB-3340-937A-9B5A59FA8F30&searchpattern=Matt Dupe&xmloutputversion=2&ts=${now():minus(600000):format( <http://api.twingly.com/analytics/Analytics.ashx?key=75744154-6ACB-3340-937A-9B5A59FA8F30&searchpattern=boycott&xmloutputversion=2&ts=$%7Bnow():minus(600000):format(> "yyyy-MM-dd HH:mm:ss")}&tsTo=${now():format("yyyy-MM-dd HH:mm:ss")} On Mon, Dec 14, 2015 at 6:16 PM, Joe Percivall < [email protected]> wrote: > Glad I could help and thanks! > - - - - - - > Joseph Percivall > linkedin.com/in/Percivall > e: [email protected] > > > > > On Monday, December 14, 2015 6:09 PM, Igor Kravzov <[email protected]> > wrote: > Thank you very much Joe. It worked. > And congratulations. > > > On Mon, Dec 14, 2015 at 6:00 PM, Joe Percivall < > [email protected]> wrote: > > > Hello Igor, > > > > You're having trouble because you have a space in your format of the > dates > > which need to be URL encoded. You can use the EL method "urlencode" to > get > > a valid expression like such: > > > > > > > http://api.twingly.com/analytics/Analytics.ashx?key=75744154-6ACB-3340-937A-9B5A59FA8F30&searchpattern=boycott&xmloutputversion=2&ts=${now():minus(600000):format( > "yyyy-MM-dd > > HH:mm:ss"):urlEncode()}&tsTo=${now():format("yyyy-MM-dd > > HH:mm:ss"):urlEncode()} > > > > Hope that helps, > > Joe > > - - - - - - > > Joseph Percivall > > linkedin.com/in/Percivall > > e: [email protected] > > > > > > > > > > On Monday, December 14, 2015 5:31 PM, Igor Kravzov < > [email protected]> > > wrote: > > Hi guys, > > > > Why I am getting the error bellow? I am constructing URL like this: > > > > > http://api.twingly.com/analytics/Analytics.ashx?key=75744154-6ACB-3340-937A-9B5A59FA8F30&searchpattern=boycott&xmloutputversion=2&ts=${now():minus(600000):format( > > "yyyy-MM-dd > > HH:mm:ss")}&tsTo=${now():format("yyyy-MM-dd HH:mm:ss")} > > > > > > Am I missing something? Thanks in advance. > > > > > > java.lang.IllegalArgumentException: Illegal character in query at index > > 143: > > > > > http://api.twingly.com/analytics/Analytics.ashx?key=75744154-6ACB-3340-937A-9B5A59FA8F30&searchpattern=boycott&xmloutputversion=2&ts=2015-12-14 > > 17:03:46&tsTo=2015-12-14 17:13:46 > > at java.net.URI.create(Unknown Source) ~[na:1.8.0_66] > > at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:69) > > ~[httpclient-4.4.1.jar:4.4.1] > > at > org.apache.nifi.processors.standard.GetHTTP.onTrigger(GetHTTP.java:444) > > ~[na:na] > > at > > > > > org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1146) > > ~[nifi-framework-core-0.4.0.jar:0.4.0] > > at > > > > > org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:139) > > [nifi-framework-core-0.4.0.jar:0.4.0] > > at > > > > > org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:49) > > [nifi-framework-core-0.4.0.jar:0.4.0] > > at > > > > > org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:119) > > [nifi-framework-core-0.4.0.jar:0.4.0] > > at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) > > [na:1.8.0_66] > > at java.util.concurrent.FutureTask.runAndReset(Unknown Source) > > [na:1.8.0_66] > > at > > > > > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown > > Source) [na:1.8.0_66] > > at > > > > > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown > > Source) [na:1.8.0_66] > > at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) > > [na:1.8.0_66] > > at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) > > [na:1.8.0_66] > > at java.lang.Thread.run(Unknown Source) [na:1.8.0_66] > > Caused by: java.net.URISyntaxException: Illegal character in query at > index > > 143: > > > > > http://api.twingly.com/analytics/Analytics.ashx?key=75744154-6ACB-3340-937A-9B5A59FA8F30&searchpattern=boycott&xmloutputversion=2&ts=2015-12-14 > > 17:03:46&tsTo=2015-12-14 17:13:46 > > at java.net.URI$Parser.fail(Unknown Source) ~[na:1.8.0_66] > > at java.net.URI$Parser.checkChars(Unknown Source) ~[na:1.8.0_66] > > at java.net.URI$Parser.parseHierarchical(Unknown Source) ~[na:1.8.0_66] > > at java.net.URI$Parser.parse(Unknown Source) ~[na:1.8.0_66] > > at java.net.URI.<init>(Unknown Source) ~[na:1.8.0_66] > > ... 14 common frames omitted > > >
