use curl to call restapi

hi guys :

I used RESTAPI to create the AFM policy , but VIP cant call this policy.

This is my code and related code error:

[root@localhost /]# curl -sk -u ‘admin:admin’ -H “Content-Type:application/json” -X PUT https://10.1.10.66/mgmt/tm/ltm/virtual/ -d ‘{“name”:“vs_ddos”,“fwEnforcedPolicy”:“policy_test”}’

{“code”:403,“message”:“Operation is not supported on component /ltm/virtual.”,“errorStack”:[],“apiError”:1}

I first create the AFM policy and then associate it with the existing virtual server,

Hi

Try this

curl -sk -u ‘admin:admin’ -H “Content-Type: application/json” -X PATCH https://10.1.10.66/mgmt/tm/ltm/virtual/vs\_ddos -d ‘{“fwEnforcedPolicy”:“/Common/policy_test”}’

hi iaine ,you are right .

why not put ? Can you explain that? Thank you very much

Which method to use? See K00842042: BIG-IP AFM iControl REST API example commands.

thanks ,JG​:smiley: