As a professional development and learning exercise I wrote this powershell module.
I do not claim it to be free from errors/bugs and is for learning and testing. Use at your own risk.
I thought it may be of some value to others out there.
Could you give us / me some insights, what you API actually can perform?
You are settings some values to configure a XG, correct?
If you want to get some "clicks clicks clicks", build Certbot + DNAT + Lets Encrypt Upload + Replacement Script.
Seems like you know, what you are doing, and this is highly asked by some people.
The script should perform something like:
Enable a specific DNAT Rule every 2 Month. (Port80 to the powershell server?).
Start Certbot to generate new LE certificates.
Disable DNAT Rule.
Upload new LE Certificate to XG
Replace in Webadmin the LE Certificate
Check in Firewall Rule for WAF Rules, replace if yes, replace the Certificate
(Clean up old LE certificate).
As a little help: https://community.sophos.com/products/xg-firewall/f/sophos-xg-firewall-general-discussion/102208/upload-certificate-using-api
To see what the certificate looks like (or any request) first do a get request of the object and you will then have an object (or many) with which you can update/modify/template. The documentation from sophos is also included in a folder there for reference with all data constraints. The database is Postgres so look there if you need to know more info about scalar etc (just a string).
The basic request can be achieved by just running New-XgApi and populating with the correct information. Following then you can run Invoke-XgApi which will spit out what the certificates look like (you could do a get filter to select just 1 if you have multiple)
To actually have a working script that is unattended you will need to use the class object instead however.
$myvar = new-xgapi -out_object and then populate the values in your script or splat the object with New-XgApi -object $object which is filled with the information from certbot etc
You can see examples of both in on in the example files
I would love to help, I don't think I will have much spare time unfortunately. I'll see if I can help at some point :)
and if you can upgrade to powershell 7 its very easy