Forum Discussion
selfLink not work for sys/hardware
Hi, I've been working with the iControl REST interface for several months. While researching the hardware information returned in the mgmt/tm/sys/hardware call, I found that I cannot use any of the selfLinks returned to narrow my request.
For instance, I'd like to get just the power supply information. The self link says Substituting the hostname for localhost I get an error: {"code":400,"message":"Found unexpected json pair at component /sys/hardware. The json pair is \"\":{\"chassis-power-supply-index\":null}.","errorstack":[]}
Am I missing something? Thanks
Despite the URL "; in the output, it does not seem to be directly accessible, even with v13.1.0. So you still need to get the whole output and use a tool to parse it. You must already have something to do the parsing. Nonetheless, here's a "simple" way I have tried to get this info:
curl -s -k -u admin:admin -X GET 'https://mgmt_IP_address/mgmt/tm/sys/hardware/' | jq '.entries."https://localhost/mgmt/tm/sys/hardware/chassis-power-supply-status-index" | tostring'
You will need jg v1.5 for this.
- Jason_Nance
Nimbostratus
As Niels said, you need to strip off the
part:chassis-power-supply-status-index
!/usr/bin/env python3 import pprint import requests requests.packages.urllib3.disable_warnings() s = requests.Session() s.auth = ('username', 'password') r = s.get('https://hostname/mgmt/tm/sys/hardware', verify=False) pprint.pprint(r.json())
You can deduce this by looking at the TMSH command to pull this information:
(there isn't atmsh show sys hardware
argument).chassis-power-supply-status-index
But once you have the JSON you can pull the info directly from there.
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