Skip to main content
Solved

How to pull JSON files from an API into FME

  • December 10, 2021
  • 4 replies
  • 88 views

Hi, all.

I'm trying to pull a couple of dozen JSON files into FME with an API through flightaware.com, so that I can build flight tracks, based on the unique flight_id of each flight.

I built a python script today that accomplishes the objective and saves all of the separate JSONs into one JSON, locally. With some help, I figured out how to pull that JSON into a couple of fragmenters and have been going from there. So, ultimately, I have the option of continuing to run the script separately from the FME session, but I was curious if anyone knows how to integrate an independent Python script into the workflow. Python caller hasn't worked for me, I assume because it's designed to process features not save files locally.

 

Also, I didn't use the http caller because the URL request was done per flight id, so I decided I'd need 20 callers running simultaneously. Is that a correct assumption, or is there way of iterating through a list to fill in the URL request multiple times?

 

Thanks!

Best answer by hkingsbury

HTTPCaller is the correct transformer to use.

 

You'll need one feature per Flight ID with the Flight ID stored as an attribute. The HTTPCaller will then need to be configured to use the attribute in the HTTP Call that is made

View original
Did this help you find an answer to your question?

4 replies

hkingsbury
Celebrity
Forum|alt.badge.img+54
  • Celebrity
  • Best Answer
  • December 10, 2021

HTTPCaller is the correct transformer to use.

 

You'll need one feature per Flight ID with the Flight ID stored as an attribute. The HTTPCaller will then need to be configured to use the attribute in the HTTP Call that is made


  • Author
  • December 10, 2021

I can pass multiple Request URL's through a single instance of HTTP Caller? Do you know where I can find an example of that?

 

Thanks for the help!


redgeographics
Celebrity
Forum|alt.badge.img+49
rdavi130 wrote:

I can pass multiple Request URL's through a single instance of HTTP Caller? Do you know where I can find an example of that?

 

Thanks for the help!

Every feature that runs through a HTTPCaller will result in a single HTTP call being made, so if you have 20 features each with a unique flight id you can use one HTTPCaller to make those 20 calls. However, you may want to use a Decelerator beforehand to slow things down a bit (many API's and web services can't handle a lot of simultaneous requests)


  • Author
  • December 10, 2021

Perfect. Thank you both!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings