Forum Discussion
Satoshi_Toyosa1
Jul 30, 2018Employee
"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.