I registered a user for API access, plugged its key and secret into curl, and got nowhere:
$ curl -k "https://xx.xx.xx.xx/api/core/backup/providers/?key=ABC&secret=XYZ"
{"message":"controller OPNsense\\Core\\Api\\BackupController not found","status":400}$
$ curl -k "https://xx.xx.xx.xx/api/core/firmware/status?key=ABC&secret=XYZ"
$
You may want to change your format, you are getting a 400 error, so your request is incorrect:
curl -k -u user:secret https://X.X.X.X/api/core/backup/providers
Response:
{"items":{"this":{"description":"This Firewall","dirname":"\/conf\/backup"}}}
The HTTP 400 Bad Request client error response status code indicates that the server would not process the request due to something the server considered to be a client error.
Quote from: peskytech on November 21, 2024, 03:44:20 PM
You may want to change your format, you are getting a 400 error, so your request is incorrect:
curl -k -u user:secret https://X.X.X.X/api/core/backup/providers
Response:
{"items":{"this":{"description":"This Firewall","dirname":"\/conf\/backup"}}}
The HTTP 400 Bad Request client error response status code indicates that the server would not process the request due to something the server considered to be a client error.
With your command format, I still get the same error 400 controller not found. Nothing changed.
Try this endpoint to download the latest configuration:
https://xxx.xxx.xxx.xxx/api/core/backup/download/this
https://github.com/opnsense/core/commit/39b531783
Quote from: Monviech (Cedrik) on November 21, 2024, 05:27:03 PM
Try this endpoint to download the latest configuration:
https://xxx.xxx.xxx.xxx/api/core/backup/download/this
https://github.com/opnsense/core/commit/39b531783
Is that available in a specific version? Which one?
I tried with 24.7.8 but it should be around for a while.
Quote from: Monviech (Cedrik) on November 21, 2024, 06:46:38 PM
I tried with 24.7.8 but it should be around for a while.
Does the API work at all in 21.7.8? Upgrading is not an option.
You probably need the os-api-backup plugin on older versions, if it exists in yours.
https://forum.opnsense.org/index.php?topic=18218.0
Quote from: Monviech (Cedrik) on November 22, 2024, 06:46:50 AM
You probably need the os-api-backup plugin on older versions, if it exists in yours.
https://forum.opnsense.org/index.php?topic=18218.0
That was the first thing that I've done before trying to use the API.