QueryVmNic

API Request

URLs
GET zstack/v1/vm-instances/nics
GET zstack/v1/vm-instances/nics/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth: 185cf639b8b64150a2aa22ec84e2517b" \
-X GET http://localhost:8080/zstack/v1/vm-instances/nics?q=ip=172.20.100.100
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth: 2e9d7313cbb6495ebb3ee5d0d5d20fde" \
-X GET http://localhost:8080/zstack/v1/vm-instances/nics/7363f51baaab41538d5fe402a69d2529

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryVmNic, and pressing the Tab key.

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
    "error": {
        "code": "SYS.1001",
        "description": "A message or a operation timeout",
        "details": "Create VM on KVM timeout after 300s"
    }
}

SDK Sample

Java SDK
QueryVmNicAction action = new QueryVmNicAction();
action.conditions = asList("ip=172.20.100.100");
action.sessionId = "ca4e59e18f014c21afcdde859b2fba3a";
QueryVmNicAction.Result res = action.call();
Python SDK
QueryVmNicAction action = QueryVmNicAction()
action.conditions = ["ip=172.20.100.100"]
action.sessionId = "8549e75dbbe548348ca2848692fb7fd8"
QueryVmNicAction.Result res = action.call()