Forum Discussion
How to Get FailOver Status via iControl REST?
To answer your follow-up question:
This is just how the rest API works. You have to do some client side manipulation to get the actual data.
Here's an example in Powershell:
$Response = (Invoke-WebRequest -Method "GET" -Headers $headers -Uri "https://mydevice.j.local/mgmt/tm/cm/failover-status?`$select=status").content | ConvertFrom-Json
$content.entries.'https://localhost/mgmt/tm/cm/failover-status/0'.nestedStats.entries.status.description
/Patrik
- ChimyNov 02, 2022Nimbostratus
Hello Patric_Jonsson
I use your example in powershell but and error appear
I tried to fix, but there are something that is missed.
Could you re-check the code?
I think that point of view to perform the task to know if the device is active/standby is pretty cool 🙂
PS C:\Windows\system32> $Response = (Invoke-WebRequest -Method "GET" -Headers $headers -Uri "https://$f5/mgmt/tm/cm/failover-status?`$select=status").content | ConvertFrom-Json $content.entries.'https://localhost/mgmt/tm/cm/failover-status/0'.nestedStats.entries.status.descriptionConvertFrom-Json : Cannot bind argument to parameter 'InputObject' because it is null.
At line:1 char:154
+ ... rtFrom-Json $content.entries.'https://localhost/mgmt/tm/cm/failover-s ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [ConvertFrom-Json], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ConvertFromJsonCommand- ChimyNov 03, 2022Nimbostratus
finally I did !!
$response = (Invoke-WebRequest -Method "GET" -Headers $headers -Uri "https://$f5/mgmt/tm/cm/failover-status?`$select=status").content
$qestate = ($response | ConvertFrom-Json).entries.'https://localhost/mgmt/tm/cm/failover-status/0'.nestedStats.entries.status.description
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com