Forum Discussion
Ensure you escape or add the encoding for the "$" and encode the space characters.
Examples against 12.1.2:
curl -u admin:admin --silent -k1 -H "Accept:application/json" -H "Content-Type:application/json" https://10.10.10.3/mgmt/tm/asm/policies | jq .items[].name
"ASM_Policy_1"
"Sharepoint_Policy"
"Exchange2010_CAS_Services"
"Portal_Policy1"
"Maps_Policy"
"External_Policy_1"
curl -u admin:admin --silent -k1 -H "Accept:application/json" -H "Content-Type:application/json" https://10.10.10.3/mgmt/tm/asm/policies?\$filter=name%20eq%20Maps_Policy | jq .items[].name
"Maps_Policy"
curl -u admin:admin --silent -k1 -H "Accept:application/json" -H "Content-Type:application/json" https://10.10.10.3/mgmt/tm/asm/policies?%24filter=name%20eq%20Maps_Policy | jq .items[].name
"Maps_Policy"
curl -u admin:admin --silent -k1 -H "Accept:application/json" -H "Content-Type:application/json" https://10.10.10.3/mgmt/tm/asm/policies | jq -c '.items[] | [{ ID: .id, Name: .name }]'
[{"ID":"EDrCrURQ0zNEXKR-7TGRPg","Name":"ASM_Policy_1"}] [{"ID":"rp76DF4GDQkAHssIm5yIVQ","Name":"Sharepoint_Policy"}] [{"ID":"jy0zD_fvPQ6GdVteE1qosA","Name":"Exchange2010_CAS_Services"}] [{"ID":"2FHNd0d4D6gDqlSvX5KEew","Name":"Portal_Policy1"}]
[{"ID":"G3-kYFxnsQjasSQSqwJpuQ","Name":"Maps_Policy"}]
[{"ID":"5jvgsA4GWEpZrbGKoc62Vw","Name":"External_Policy_1"}]
curl -u admin:admin --silent -k1 -H "Accept:application/json" -H "Content-Type:application/json" https://10.10.10.3/mgmt/tm/asm/policies?%24filter=name%20eq%20GIS_Maps | jq -c '.items[] | [{ ID: .id, Name: .name }]'
[{"ID":"G3-kYFxnsQjasSQSqwJpuQ","Name":"GIS_Maps"}]
curl -u admin:admin --silent -k1 -H "Accept:application/json" -H "Content-Type:application/json" https://10.10.10.3/mgmt/tm/asm/policies?%24filter=name%20eq%20GIS_Maps | jq '.items[].id'
"G3-kYFxnsQjasSQSqwJpuQ"
If you are unsure of the query, use Postman or similar. If the filter returns the desired results, it's likely you need to escape or encode what you are sending via the command line.