Forum Discussion
How do I apply asm policy using iControlREST?
I'm trying to change enforcementMode by using RESTAPI. But I can not apply-policy.
GET /mgmt/tm/asm/policies/js4y3P-sabtgiQOxWlU6Vg
{ ... "enforcementMode": "transparent", "isModified": false, ... }
PATCH /mgmt/tm/asm/policies/js4y3P-sabtgiQOxWlU6Vg
{ "enforcementMode": "blocking" }
GET /mgmt/tm/asm/policies/js4y3P-sabtgiQOxWlU6Vg
{ ... "enforcementMode": "blocking", "isModified": true, ... }
POST /mgmt/tm/asm/tasks/apply-policy/js4y3P-sabtgiQOxWlU6Vg (body is empty)
{ ... "code": 400, "message": "request.body", ... }
POST /mgmt/tm/asm/tasks/apply-policy/js4y3P-sabtgiQOxWlU6Vg (body is '{}')
{ ... "code": 404, "message": "Could not get the Apply Policy Task, No matching record was found.", ... }
Thanks in Advance.
2 Replies
- kunjan
Nimbostratus
See if this works:
curl -sk -u admin:admin -H "Content-Type: application/json" -X POST -d '{"policyReference": {"link":"https://localhost/mgmt/tm/asm/policies/js4y3P-sabtgiQOxWlU6Vg"}} ' https://mgmt-ip/mgmt/tm/asm/tasks/apply-policy/ - yuki_nishi_1495
Nimbostratus
Thanks for your help, that works just fine!
1. POST /mgmt/tm/asm/tasks/apply-policy/
{"policyReference": {"link":"https://localhost/mgmt/tm/asm/policies/js4y3P-sabtgiQOxWlU6Vg"} }
Response:{ ..."status": "NEW","lastUpdateMicros": 1402897197000000, ...}
2. GET /mgmt/tm/asm/policies/js4y3P-sabtgiQOxWlU6Vg
Response: { ..."enforcementMode": "blocking","isModified": false, ...}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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