AddBackendServerToServerGroup

API Request

URLs
POST zstack/v1/load-balancers/servergroups/{serverGroupUuid}/backendservers
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "vmNics": [
      {
        "70856dd6ee693c30b28e6233850fc494": "10"
      }
    ],
    "servers": [
      {
        "192.168.1.1": "20"
      }
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"vmNics":[{"70856dd6ee693c30b28e6233850fc494":"10"}],"servers":[{"192.168.1.1":"20"}]}}' http://localhost:8080/zstack/v1/load-balancers/servergroups/9e9c1f7a74ce3cb6b51d4f938537f765/backendservers
Request Parameters
Name Type Location Description Valid Value Starting Version
serverGroupUuid String url The UUID of the server group for load balancing. 4.0.0
vmNics List body(contained in the params structure) Optional. The NIC of the backend server. 4.0.0
servers List body(contained in the params structure) Optional. The IP address of the backend server. 4.0.0
systemTags List body Optional. The system tags. 4.0.0
userTags List body Optional. The user tags. 4.0.0

API Response

Sample Response
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
AddBackendServerToServerGroupAction action = new AddBackendServerToServerGroupAction();
action.serverGroupUuid = "9e9c1f7a74ce3cb6b51d4f938537f765";
action.vmNics = asList([70856dd6ee693c30b28e6233850fc494:10]);
action.servers = asList([192.168.1.1:20]);
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddBackendServerToServerGroupAction.Result res = action.call();
Python SDK
AddBackendServerToServerGroupAction action = AddBackendServerToServerGroupAction()
action.serverGroupUuid = "9e9c1f7a74ce3cb6b51d4f938537f765"
action.vmNics = [[70856dd6ee693c30b28e6233850fc494:10]]
action.servers = [[192.168.1.1:20]]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddBackendServerToServerGroupAction.Result res = action.call()