Forum Discussion
Jonathan_de_GAV
Altostratus
Sep 22, 2017Create Virtual Server with curl, json and icontrol REST
Hi, I want to create a virtual server on my server with curl commad and json.
To create my server named "myserver",I use this :
curl -sku admin:admin [https://localhost/mgmt/tm/gtm/server](https://localhost/mgmt/tm/gtm/server) -H 'Content-Type: application/json' -X POST -d '{
"kind": "tm:gtm:server:serverstate",
"name": "myserver",
"partition": "Common",
"fullPath": "/Common/myserver",
"generation": 131985,
"selfLink": "[https://localhost/mgmt/tm/gtm/server/~Common~myserver?ver=11.6.1"](https://localhost/mgmt/tm/gtm/server/~Common~myserver?ver=11.6.1);,
"datacenter": "/Common/Normandie",
"enabled": true,
"exposeRouteDomains": "no",
"iqAllowPath": "yes",
"iqAllowServiceCheck": "yes",
"iqAllowSnmp": "yes",
"limitCpuUsage": 0,
"limitCpuUsageStatus": "disabled",
"limitMaxBps": 0,
"limitMaxBpsStatus": "disabled",
"limitMaxConnections": 0,
"limitMaxConnectionsStatus": "disabled",
"limitMaxPps": 0,
"limitMaxPpsStatus": "disabled",
"limitMemAvail": 0,
"limitMemAvailStatus": "disabled",
"linkDiscovery": "disabled",
"product": "generic-load-balancer",
"virtualServerDiscovery": "disabled",
"addresses": [{
"name": "10.10.10.14",
"deviceName": "/Common/myserver",
"translation": "none"
}
],
"virtualServersReference": {
"link": "[https://localhost/mgmt/tm/gtm/server/~Common~myserver/virtual-servers?ver=11.6.1"](https://localhost/mgmt/tm/gtm/server/~Common~myserver/virtual-servers?ver=11.6.1);,
"isSubcollection": true
}
}'
But when I try to create the virtual server with this command, it doesn't work :
curl -sku admin:admin [https://localhost/mgmt/tm/gtm/server/virtual-servers](https://localhost/mgmt/tm/gtm/server/virtual-servers) -H 'Content-Type: application/json' -X POST -d '{
"kind": "tm:gtm:server:virtual-servers:virtual-serverscollectionstate",
"selfLink": "[https://localhost/mgmt/tm/gtm/server/myserver/virtual-servers?ver=11.6.1"](https://localhost/mgmt/tm/gtm/server/myserver/virtual-servers?ver=11.6.1);,
"items": [{
"kind": "tm:gtm:server:virtual-servers:virtual-serversstate",
"name": "VS_test_1",
"fullPath": "VS_test_1",
"generation": 131989,
"selfLink": "[https://localhost/mgmt/tm/gtm/server/myserver/virtual-servers/VS_test_1?ver=11.6.1"](https://localhost/mgmt/tm/gtm/server/myserver/virtual-servers/VS_test_1?ver=11.6.1);,
"destination": "10.10.10.43:80",
"enabled": true,
"limitMaxBps": 0,
"limitMaxBpsStatus": "disabled",
"limitMaxConnections": 0,
"limitMaxConnectionsStatus": "disabled",
"limitMaxPps": 0,
"limitMaxPpsStatus": "disabled",
"monitor": "/Common/http ",
"translationAddress": "none",
"translationPort": 0
}
]
}'
- Stanislas_Piro2
Cumulonimbus
Hi,
I never did it with icontrol but in tmsh, I remember we don't create a GTM VS but modify GTM server to add VS...
So I guess the HTTP method should be PATCH and not POST.
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