That can easily be done with SQL, most likely in a single statement. I don't have time just now to study the API but you can probably modify the example here
https://github.com/fathert/json-rpg-example/blob/master/google-geocode-example.sql
This calls the Google Geo API for three cities and stores the result in a temporary table. The QUERY_STRING CTE just prepares three different example requests so you can simplify the SQL by getting rid of that bit if you can get all of your data in a single request. The parsing is also very simple, it just plucks three elements from the result. If you need to process arrays of data in the result, then see some of the other examples in the same repo. Finally, instead of creating a temporary table, you'd wrap this in an insert to your target table.
Tim.
________________________________
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> on behalf of mlazarus <mlazarus@xxxxxxxxxxxx>
Sent: 20 May 2021 23:32
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Retrieving fuel price data from eia.gov
Has anyone here used the API retrieval of the fuel price data (diesel,
jet fuel, etc.) from eia.gov? Their API documentation page is:
https://www.eia.gov/opendata/commands.php
Preference is in either SQL or RPG. I'm looking to query the weekly
fuel prices for a range of dates and bring it into the system, on an
ongoing basis. Doing it via Excel is clumsier to me, if I can do it
directly in RPG or SQL. TIA.
-mark
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.