Forum Discussion
How to use REST to create a Virtual Server with profile
Hello I tested this for HTTP VS
First make a POST of Generic Virtual Server with HTTP
curl -k --user admin:admin -H "Accept: application/json" -H "Content-Type:application/json" -X POST -d@ServiceRouting_forHTTP.json https://173.36.215.237/mgmt/tm/ltm/virtual/ | python -m json.tool
Payload file below ServiceRouting_forHTTP.json
{ "addressStatus": "yes", "autoLasthop": "default", "cmpEnabled": "yes", "connectionLimit": 0, "destination": "/Common/192.168.32.11:80", "enabled": true, "fullPath": "ServiceRouting_forHTTP", "generation": 37093, "gtmScore": 0, "ipProtocol": "tcp", "kind": "tm:ltm:virtual:virtualstate", "mask": "255.255.255.255", "mirror": "disabled", "mobileAppTunnel": "disabled", "name": "ServiceRouting_forHTTP", "nat64": "disabled", "policiesReference": { "isSubcollection": true, "link": "" }, "pool": "/Common/S4HPool", "profilesReference": { "isSubcollection": true, "link": "" }, "rateLimit": "disabled", "rateLimitDstMask": 0, "rateLimitMode": "object", "rateLimitSrcMask": 0, "selfLink": "", "source": "0.0.0.0/0", "sourceAddressTranslation": { "type": "automap" }, "sourcePort": "preserve", "synCookieStatus": "not-activated", "translateAddress": "enabled", "translatePort": "enabled", "vlansDisabled": true, "vsIndex": 32 }
Then make a PUT so that we add the HTTP Profile and also the iRule
curl -s -k -u admin:admin -H 'Content-Type: application/json' -X PUT https://173.36.215.237/mgmt/tm/ltm/virtual/ServiceRouting_forHTTP -d '{"profiles":[{"name":"http"},{"name":"tcp"}], "rules": ["/Common/Testing_class"]}' |python -m json.tool
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