The geoevent service works fine with the base url but it doesnt work when I setup the query part of the url in the parameter field in input connector. Is there anything I need to do to get the query part working?

1795
5
08-02-2018 01:01 PM
JulieK
by
Occasional Contributor

Hello,

Connecting to flightaware api with 'Poll an External Website for JSON' . The Geoevent service works fine with just the base url 

http://flightxml.flightaware.com/json/FlightXML2/SearchBirdseyeInFlight

The activeflight method allows to query and I setup the query part in 'parameter' part of input connector. The input connector stops working with the query part. 

Has setting  the parameter worked for anybody? Any thoughts or ideas or workarounds? Thanks in advance.

0 Kudos
5 Replies
DanielCota1
Occasional Contributor

Hello J molk

May I ask what is the result if you were to manually construct the query URL by appending the parameters yourself and then see if it is resolvable on a web browser on the GeoEvent Server?

i.e. http://flightxml.flightaware.com/json/FlightXML2/SearchBirdseyeInFlight?parameter1=test&parameter2=t...

I see that the base URL needs authentication to access, so I am assuming you include that information in the Header Parameter Name:Value List field? Either way, it could be that the query string that is being added is either in a format that Geoevent cannot recognize or that it is in some way invalid.

Please see if you can test manually constructing the URL and then navigating to it in a browser. If that works to return the expected JSON, try seeing if you can use that URL as the value for the URL field in the input connector.

It would also be working double-checking that the MIME types included in the input connector are:

text/json, application/json

You can also check the Geoevent logs to see if any messages were logged for inaccessibility to the URL you provided.

0 Kudos
JulieK
by
Occasional Contributor

Thanks for your response !!

Yes, the base url includes the credentials and is able to connect to flightaware successfully.  When I put the query part of the url (  query={range lat 38.8863 40.897669} {range lon -79.03655 -77.1236} ) in the parameter field, the input connector doesn't work. Checked the log files and it gives error with ' invalid at index 135'.  Looks like Geoevent doesn't recognize '=' or '{'  To resolve the error, I encoded the query part of the url and that resolved the issue and now input is able to connect . However the data received from flightaware  isn't queried. The data returned includes all lat/long 

It appears that flightaware doesn't like the encoded url.  The encoded url in a browser also return wrong data .

Any thoughts?

0 Kudos
DanielCota1
Occasional Contributor

Understood. I agree that it would be a stretch for Geoevent to play nicely with the {} special characters. However, it may not matter if the URL in a browser does not work.

Put simply, Geoevent will read any data that is accessible at a certain endpoint. Whether that is just all of the JSON for a certain resource, or queried JSON, it's all the same to Geoevent. JSON is JSON. If it does not work in a browser, then it likely will not work in Geoevent.

-Daniel

0 Kudos
AdamRepsher
Occasional Contributor III

Hi J molk‌,

So, I was able to make a connection and successfully query our tail numbers in SearchBirdseyeInFlight easily with Postman.  Frustrating to say the least when I couldn't get the query that I wanted to work in GeoEvent Server.  I just kept plugging away.  The key for me was moving to the Post HTTP Method.  I was then able to play around with URL Encoding in the Post Body in hopes of finding something that GeoEvent would accept it. It finally works! 

Anyway - here is what I came up with....

Using Poll an External Website for JSON input:

  • URL stays the same:  http://flightxml.flightaware.com/json/FlightXML2/SearchBirdseyeInFlight
  • Another important part - I had to manually create the GeoEvent Definition to match the Parsed JSON based on the JSON object "altitude".
    • Create GeoEvent DefinitionNo.
    • GeoEvent Definition Name (Existing)[Your Definition Name Here] Note table picture below...
  • HTTP MethodPost
  • Header Parameter Name:Value List:  Authorization: Basic [your "username:key" that is Base64 encoded
  • Post From: Content Body
  • Post Body: I was able to ONLY URL Encode the spaces within the Body to get the result:
    • In my case, the Post Body looked like this:  
      query={ident_or_reg%20{TAIL1%20TAIL2%20TAIL3%20TAIL4%20TAIL5%20TAIL6%20TAIL7%20TAIL8%20TAIL9%20TAIL10%20TAIL11}}
    • In your case, the Post Body might look like this:
      query={range%20lat%2038.8863%2040.897669}%20{range%20lon%20-79.03655%20-77.1236}
  • Post body MIME Type: text/plain
  • JSON Object Name:  aircraft

The GeoEvent Definition looks like this:

GeoEvent Definition for FlightXML SearchBirdseyeInFlight Operation

Let me know how you make out - or already figured it out on your own!!!

--Adam

#geoevent#flight#flighttracking#flightxml#flightaware#firehose#cheaper#faa#avl

JulieK
by
Occasional Contributor

thanks Adam, I got it working.