Forum Discussion
Nazir_52641
Cirrus
Sep 19, 2018Retrieving ASM Policy ID or md5hash without fetching entire ASM policy list
Is there a way to get the ASM policy ID or MD5Hash for ASM Policy without fetching all the existing policy. In the production environment we have more than 200+ ASM policy and fetching all 200 will h...
suttonsc
Employee
Oct 10, 2018Depending 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"
}
]
}
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects