Hi everyone
I'm struggling to find a way to perform a Major update (e.g. from 19.1 to 19.7) using the API. Is there anyone who has successfully done this using the API or other programmatic method?
I found the answer to make it go via cmd:
sudo --user=nobody /usr/local/sbin/configctl firmware auto-update ALLOW_RISKY_MAJOR_UPGRADE
Here is the Powershell version (including ignoring ssl error)
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
$user = 'APIKEY'
$pass = 'APISECRET'
$pair = "$($user):$($pass)"
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
$basicAuthValue = "Basic $encodedCreds"
$Headers = @{
Authorization = $basicAuthValue
}
$URL = "https://IPOFROUTER/api/core/firmware/upgrade"
Invoke-WebRequest -uri $url -method post -Headers $Headers -Body '{"upgrade":"maj"}' -ContentType "application/json"