0

I make a call to an HPE iLO to pull back SNMP v3 user information. I get:

curl --silent --insecure --header "X-API-Token: ${iLOAuth}" --request GET ${iLOSSO}/redfish/v1/Managers/v1/snmpservice/snmpusers | jq -r '.Members[]'

and get back:

{
   "@odata.id": "/redfish/v1/Managers/1/SnmpService/SNMPUsers/1"
}
{
   "@odata.id": "/redfish/v1/Managers/1/SnmpService/SNMPUsers/3"
}

I just want to get back the values, but if I try:

jq -r '.Members[] | .@odata.id'

I get back an error. Does anyone know the proper syntax to use?

user2664304
  • 27
  • 1
  • 5
  • `.Members[] | ."@odata.id"` or `.Members[] | .["@odata.id"]` – Inian Nov 23 '22 at 11:33
  • Found the answer here: [link](https://stackoverflow.com/questions/42809577/json-object-contains-odata-id-how-to-get-it-out). If I use `jq -r '.Members[] | .["@data.id"]'` I get the correct values. Thanks for looking! – user2664304 Nov 23 '22 at 11:57
  • I think part of my confusion was I saw the output as above. It was really: `[ "@odata.id":...` an array. – user2664304 Nov 23 '22 at 12:02

0 Answers0