On Fri, Apr 26, 2024, 2:18 AM Chris <chris@ardc.net> wrote:
The URL is wrong and you need a Bearer token not Basic authentication, also you should probably add an Accept: header, so this should work to get the JSON:

curl -s -H "Authorization: Bearer YourApiTokenHere" -H "Accept: application/json" https://portal.ampr.org/api/v1/encap/routes

Thank-you. That worked to retrieve the JSON file. The jq parsing from the wiki did not work. There was an error message, but I'm not at my desk now and don't recall the details. A simpler jq parse to add line breaks for human readability worked fine.

I wrote a very ugly perl script that runs the simpler jq parse, then reads the resulting file line by line and builds a new file in "JNOS" format. It doesn't truncate the last octet if it's zero, though. For normal operation, that's neither needed nor desired.

I'm just now noticing the message from Andreas, so I probably wrote the bulk of that script for nothing, lol. Oh well, it's done, and it automatically downloads and converts the file.

If you’re subscribed to 44Net on groups.io <http://groups.io/> I posted a PHP script to download and parse the encap routes a couple of weeks ago: https://ardc.groups.io/g/44net/message/93

I haven't subscribed yet but will shortly.

When I get a moment I will put that on the Wiki.

Thanks,
Lee K5DAT