[Solved] API - Convert Configuration Byte Array to Original Configuration

Unimus support forum
Post Reply
qhillerich
Posts: 2
Joined: Fri Jun 12, 2020 10:14 pm

Fri Jun 12, 2020 10:25 pm

Hello,

I managed to use the API for Unimus to get the backup configuration "bytes field" without the double quotation marks (using jq and sed). I need to convert it to the actual device configuration.

The reason being is that I manage a phone network for a datacenter & ISP (my customer) and they want to make sure that they have a copy of all of their configurations. Currently I store their configurations on an FTP server. I would like to create a cron that saves the configs to the FTP server, as there are several firewalls and switches that I still need to create automated configuration backups for.

All I need is a way to convert the aforementioned byte array via shell/bash to the original configuration text file.

Do you all have a way to do this? Afterwards I would be happy to share a redacted version of the completed script on here in order to help other people out once I have this missing piece.
User avatar
Tomas
Posts: 1206
Joined: Sat Jun 25, 2016 12:33 pm

Fri Jun 12, 2020 10:52 pm

Hi,

Off the top of my head, the byte array in the "Backups - get device backups" API endpoint is just a base64 encoded string.
In bash you can simply "| base64 -d" that string, and it should output the original.
qhillerich
Posts: 2
Joined: Fri Jun 12, 2020 10:14 pm

Fri Jun 12, 2020 10:55 pm

That worked, Thank you!
Post Reply