I use curl to have this answer :
curl -sX https://xx.com | jq -r '.res.out[].server // empty | {host: .host, description: .description}'
{ "host": "server1","description": "server 1"}{ "host": "server2","description": "server 2"}{ "host": "server3","description": "server 3"}
And I use a second curl to get the state of serveur if it is running or not. on second curl I need the name of host to get the state of server which I get on first curl, and I want to add also the description of server.
So, I would like to store the list of host and description on a map, to use on second curl
for host in ${array_host[@]}; do echo "HOST: $host"; echo "Description: $description" curl -sX https://xx.com/servers/$host | jq -r '.specInfo.resul.out[].server.operationalStatus //empty';done
because on second curl, I have to loop on all server to get the state, for instance :
curl -sX https://xx.com/servers/server1 | jq -r '.specInfo.resul.out[].server.operationalStatus //empty';RUNNINGcurl -sX https://xx.com/servers/server2 | jq -r '.specInfo.resul.out[].server.operationalStatus //empty';RUNNINGcurl -sX https://xx.com/servers/server3 | jq -r '.specInfo.resul.out[].server.operationalStatus //empty';NOT RUNNING
I expect somethink like that
HOST: Server1Description: Server 1RUNNINGHOST: Server2Description: Server 2RUNNINGHOST: Server3Description: Server 3NOT RUNNING