Forum Discussion
Gesquiere_12886
Nimbostratus
Jul 30, 2018How to apply a ltm policy to a virtual with icontrolRest on BigIp F5
Hello,
BigIp F5 Version 11.5.4.
I've created a ltm policy with IcontrolRest : POST https:///mgmt/tm/ltm/policy/ + Json
Now I try to apply this policy to a virtual server.
I've tried a lot of uri...
Satoshi_Toyosa1
Jul 30, 2018Ret. Employee
"Missing name" sounds like the request didn't have the name of the policy.
Take a look at the JSON object you get when you query (GET) the virtual. e.g.,
curl -sku admin: https:///mgmt/tm/ltm/virtual/vs\?\$select=policiesReference\&expandSubcollections=true
where vs is the virtual. An example output as below:
{
"policiesReference": {
"isSubcollection": true,
"items": [
{
"fullPath": "/Common/TestPolicy",
"generation": 20,
"kind": "tm:ltm:virtual:policies:policiesstate",
"name": "TestPolicy",
"nameReference": {
"link": "https://localhost/mgmt/tm/ltm/policy/~Common~TestPolicy?ver=13.1.0.3"
},
"partition": "Common",
"selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~vs/policies/~Common~TestPolicy?ver=13.1.0.3"
}
],
"link": "https://localhost/mgmt/tm/ltm/virtual/~Common~vs/policies?ver=13.1.0.3"
}
}
The
policiesReference contains the items, and the items is an array (list) of the multiple policy objects. In each policy object, there is a name field. Specify the policy you want to attach. For example,
curl -sku admin: https:///mgmt/tm/ltm/virtual/vs \
-H "Content-type: application/json" -X PATCH \
-d '{"policiesReference":{ "items":[ {"name":"TestPolicy"} ] } }'
Be careful with the closing ] and } as the data is heavily nested.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects
