Support Questions

Find answers, ask questions, and share your expertise

Can you add incoming attributes to a url in InvokeHTTP?

avatar
Expert Contributor

Hi, i have an UpdateAttribute processor that creates 2 attributes longitude and latitude as follows

longitude   {line:getDelimitedField(9,'|')}

i am trying to add them into a url in the following InvokeHTTP processor with the following configuration but its not working

http://api.met.no/weatherapi/locationforecast/1.9/?lat=${latitude};lon=${longitude}

Is this possible or have i gone about it incorrectly. The URL works when i enter in the longitude   and latitude figures manually
Thank you
1 ACCEPTED SOLUTION

avatar
Master Guru

If you are using ${line:getDelimitedField(9,'|')} then there needs to be a flow file attribute called "line" that contains the string you want to evaluate.

Does your flow extract the contents of the flow file into an attribute called "line" ?

If not you could use ExtractText to do this.

View solution in original post

4 REPLIES 4

avatar
Master Guru

The URL property supports expression language so that should be fine. You may want to double check that the flow files have the attributes you expect. You could have a RouteOnAttribute that routes ${latitude:isEmpty():or(longitude:isEmpty())} to somewhere so that by the time it makes it to InvokeHttp you know you have both values, or you could just use a LogAttribute and check the logs.

avatar
Expert Contributor

Hi @Bryan Bende. Thanks for the reply. I added a logAttribute and it shows there is no value for latitude or longitude. i dont know why its not working. The data i am using is from the data simulator in the trucking app. The previous processor routes the truck_geo_events to the updatettribute processor.

longitude   {line:getDelimitedField(9,'|')}

2017-02-15 18:49:56.779|truck_geo_event|92|10|George Vetticaden|1594289134|Memphis to Little Rock Route 2|Normal|34.8|-92.09|1|

This looks like it should work though?

avatar
Master Guru

If you are using ${line:getDelimitedField(9,'|')} then there needs to be a flow file attribute called "line" that contains the string you want to evaluate.

Does your flow extract the contents of the flow file into an attribute called "line" ?

If not you could use ExtractText to do this.

avatar
Expert Contributor

Hi, that makes sense. I used ExtractText and it worked, thanks for the help