This can be accomplished via the following steps:
Get the policy id for the policy or policies:
All policies:
https://{{bigip_mgmt}}/mgmt/tm/asm/policies?$select=name,id
Filter for single policy by name:
https://{{bigip_mgmt}}/mgmt/tm/asm/policies?$filter=name eq 'Child_1'&$select=name,id
{
"kind": "tm:asm:policies:policycollectionstate",
"selfLink": "https://localhost/mgmt/tm/asm/policies?$select=name%2Cid&ver=13.1.1&$filter=name%20eq%20'Child_1'",
"totalItems": 1,
"items": [
{
"kind": "tm:asm:policies:policystate",
"selfLink": "https://localhost/mgmt/tm/asm/policies/N92Kq8isMxe18Nzg3GzqTg?ver=13.1.1",
"name": "Child_1",
"id": "N92Kq8isMxe18Nzg3GzqTg"
}
]
}
Then access the learning mode:
https://{{bigip_mgmt}}/mgmt/tm/asm/policies/N92Kq8isMxe18Nzg3GzqTg/policy-builder?$select=learningMode
{
"kind": "tm:asm:policies:policy-builder:policy-builderstate",
"selfLink": "https://localhost/mgmt/tm/asm/policies/N92Kq8isMxe18Nzg3GzqTg/policy-builder?$select=learningMode&ver=13.1.1",
"learningMode": "manual"
}
Now change via Patch:
https://{{bigip_mgmt}}/mgmt/tm/asm/policies/N92Kq8isMxe18Nzg3GzqTg/policy-builder
Body:
{
"learningMode": "disabled"
}
Check the change has taken place:
https://{{bigip_mgmt}}/mgmt/tm/asm/policies/N92Kq8isMxe18Nzg3GzqTg/policy-builder?$select=learningMode
{
"kind": "tm:asm:policies:policy-builder:policy-builderstate",
"selfLink": "https://localhost/mgmt/tm/asm/policies/N92Kq8isMxe18Nzg3GzqTg/policy-builder?$select=learningMode&ver=13.1.1",
"learningMode": "disabled"
}
Ensure you apply the policy to enforce the change.