Forum Discussion

yuki_nishi_1495's avatar
yuki_nishi_1495
Icon for Nimbostratus rankNimbostratus
Jun 12, 2014

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's avatar
    kunjan
    Icon for Nimbostratus rankNimbostratus

    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/