Forum Discussion
suttonsc
Oct 10, 2018Employee
Depending on the version you should be able to use select and filter to only return the values you want.
Example using 'select':
curl -sku admin:admin https://${bigip_mgmt}/mgmt/tm/asm/policies?\$select=name,id | jq .
{
"kind": "tm:asm:policies:policycollectionstate",
"selfLink": "https://localhost/mgmt/tm/asm/policies?$select=name%2Cid&ver=13.1.0",
"totalItems": 3,
"items": [
{
"kind": "tm:asm:policies:policystate",
"selfLink": "https://localhost/mgmt/tm/asm/policies/fAbyu1LnMcZ4DIMoZbX8aQ?ver=13.1.0",
"name": "pabnagd_testing",
"id": "fAbyu1LnMcZ4DIMoZbX8aQ"
},
{
"kind": "tm:asm:policies:policystate",
"selfLink": "https://localhost/mgmt/tm/asm/policies/qeho9K6GhLF0y7x7kShkHw?ver=13.1.0",
"name": "Policy_1",
"id": "qeho9K6GhLF0y7x7kShkHw"
},
{
"kind": "tm:asm:policies:policystate",
"selfLink": "https://localhost/mgmt/tm/asm/policies/1ClbVJ8ymjI19OMzkHeN2Q?ver=13.1.0",
"name": "Policy_2",
"id": "1ClbVJ8ymjI19OMzkHeN2Q"
}
]
}
Example using 'filter' and 'select' to extract a specific policy:
curl -sku admin:admin https://${bigip_mgmt}/mgmt/tm/asm/policies?\$filter=name%20eq%20"Policy_1"\&\$select=name,id | jq .
{
"kind": "tm:asm:policies:policycollectionstate",
"selfLink": "https://localhost/mgmt/tm/asm/policies?$select=name%2Cid&ver=13.1.0&$filter=name%20eq%20Policy_1",
"totalItems": 1,
"items": [
{
"kind": "tm:asm:policies:policystate",
"selfLink": "https://localhost/mgmt/tm/asm/policies/qeho9K6GhLF0y7x7kShkHw?ver=13.1.0",
"name": "Policy_1",
"id": "qeho9K6GhLF0y7x7kShkHw"
}
]
}