Trying to format and filter a json response from a storage api rest call.
I can do the api call fine using the following command:
$volume023 =Invoke-WebRequest -Method Get -Credential $cred -Uri $resource -Header @{ "X-Access-Key" = $apiKey }
getting the following response:
{
"response": {
"status": 0,
"volume": {
"name": "volume-00000009",
"display_name": "volume023",
"cg_display_name": "volume023",
"cg_name": "cg-0000001e",
"cg_user_created": "NO",
"pool_display_name": "SMC01_Pool2",
"pool_name": "pool-00000002",
"status": "In-use",
"virtual_capacity": 5000,
"server_name": "BRIPVWOW001",
"data_type": "File-System",
"thin": "NO",
"encryption": "NO",
"total_capacity": 4999.0234375,
"available_capacity": 1792.84472656,
"allocated_capacity": 3209.3359375,
"data_copies_capacity": 491.987060547,
"access_type": "SMB",
"read_only": "NO",
"nfs_export_path": "10.200.150.90:/export/volume023",
"smb_export_path": "\\\\10.200.150.90\\volume023",
"mount_sync": "YES",
"atime_update": "NO",
"ext_metering": "NO",
"smb_only": "NO",
"smb_guest": "NO",
"smb_windows_acl": "YES",
"smb_map_archive": "YES",
"smb_file_create_mask": "0744",
"smb_dir_create_mask": "0755",
"smb_aio_size": 1,
"capacity_history": 60,
"alert_mode": 360,
"target": null,
"lun": null,
"cache": null,
"tenant_id": 12,
"read_iops_limit": "0",
"read_mbps_limit": "0",
"write_iops_limit": "0",
"write_mbps_limit": "0",
"thresholds": null,
"created_at": "2012-06-12T08:57:16+00:00",
"modified_at": "2015-07-20T19:43:59+00:00"
}
}
}
I’d like to filter this to just:
“total_capacity”: 4999.0234375
“available_capacity”: 1792.84472656,
and pipe it as a variable so it can be embedded in an automated email
Any help here would be greatly appreciated