Skip to main content
Solved

How to pull JSON files from an API into FME

  • December 10, 2021
  • 4 replies
  • 115 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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

hkingsbury
Celebrity
Forum|alt.badge.img+63
  • Celebrity
  • 1620 replies
  • 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
  • 4 replies
  • 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+59
  • Celebrity
  • 3699 replies
  • 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!

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
  • 4 replies
  • December 10, 2021

Perfect. Thank you both!