Forum Discussion
Api Rest - Assign LTM policy to virtual server
Hi, from this article it looks the way to assign LTM policy to VS is through
POST /mgmt/tm/ltm/virtual/~Common~/policies
with body {"name": ""}
.
Well, it works for me, but I always get 404 in the response. When I check VS via GUI, I see policy being assigned.
So it works, but why I get 404, does anyone know? Btw, I work with standard LTM policies/rules, not with ASM, but there should be no difference.
I use v12.1.3.4
Thx, Zdenek
- PeteWhite
Employee
Have you retrieved the message that is sent with the 404? Try using Postman to do it manually and see it in more detail. It could be that you are missing a profile on the VS and it is complaining.
- Zdenda
Cirrus
Hi, I used Postman, check the message:
{ "code": 404, "message": "Object not found - https_pool-select_policy", "errorStack": [], "apiError": 1 }
The payload:
{ "name": "https_pool-select_policy" }
All objects are in the same partition.
- Satoshi_Toyosa1Ret. Employee
Hmmm... I did not have any issue with the same call.
curl -D - -sku : https:///mgmt/tm/ltm/virtual/vs/policies \ -H "Content-type: application/json" -X POST \ -d '{"name":"TestPolicy"}' HTTP/1.1 200 OK Date: 25 Jan 2019 01:03:23 UTC .... {"kind":"tm:ltm:virtual:policies:policiesstate","name":"TestPolicy","fullPath":"TestPolicy","generation":205,"selfLink":"https://localhost/mgmt/tm/ltm/virtual/vs/policies/TestPolicy?ver=13.1.1.2"}
Has the policy
been published (i.e., not in the draft state)? Check it it exists:https_pool-select_policy
GET /mgmt/tm/ltm/policy/https_pool-select_policy
- Satoshi_Toyosa1Ret. Employee
The
(tilda) notation is for URI encoding to avoid mixing up the BIG-IP partition/folder delimiter and URI's slash. See also p. 13 of iControl REST User Guide Version 13.1. You should use the standard BIG-IP partition/folder notation (e.g. /Common/virtualX) in the payload.~
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