Skip to content
Pavel Zinin edited this page Jan 30, 2019 · 7 revisions

GraphQL API

The API is self-documented, you can view it in GraphiQL via /graphiql/, or view API graph via /voyager

Below are some examples

Examples

Query about all VMs available for user

Input

query{
  vms{
    interfaces
    {
      id
      ip
      MAC
      attached
      status
      network {
        uuid
        nameLabel
        VMs
        {
          uuid
          nameLabel
        }
      }
    }
    nameLabel
    uuid
    nameDescription
    PVDriversVersion {
      major
      minor
      micro
      build
    }
    osVersion {
      name
      uname
      distro
      major
      minor
    }
    disks {
      id
      attached
      bootable
      device
      mode
      type
      VDI{
        nameLabel
        virtualSize
        ... on ISO
        {
          location
        }
        SR {

          nameLabel
          contentType
        }
      }
    }
  }
}

Output

{
  "data": {
    "vms": [
      {
        "interfaces": [
          {
            "id": "0",
            "ip": null,
            "MAC": "26:12:fd:75:41:63",
            "attached": true,
            "status": "",
            "network": {
              "uuid": "920b8d47-9945-63d8-4b04-ad06c65d950a",
              "nameLabel": "Pool-wide network associated with eth0",
              "VMs": [
                {
                  "uuid": "158e2b50-440e-f0bb-6b98-a9b8aaab1e25",
                  "nameLabel": "Create from Utility NEW"
                },
                null,
                null
              ]
            }
          }
        ],
        "nameLabel": "Create from Utility NEW",
        "uuid": "158e2b50-440e-f0bb-6b98-a9b8aaab1e25",
        "nameDescription": "",
        "PVDriversVersion": {
          "major": null,
          "minor": null,
          "micro": -1,
          "build": null
        },
        "osVersion": {
          "name": null,
          "uname": null,
          "distro": null,
          "major": null,
          "minor": null
        },
        "disks": [
          {
            "id": "OpaqueRef:6ed320d1-754e-efb3-d94c-5fd6cdb8e5d7",
            "attached": true,
            "bootable": true,
            "device": "xvda",
            "mode": "RW",
            "type": "Disk",
            "VDI": {
              "nameLabel": "0",
              "virtualSize": 209715200,
              "SR": {
                "nameLabel": "Local storage",
                "contentType": "user"
              }
            }
          },
          {
            "id": "OpaqueRef:ed08384d-1d53-f1f2-d1c2-e3faef2cb6df",
            "attached": true,
            "bootable": true,
            "device": "xvdb",
            "mode": "RO",
            "type": "CD",
            "VDI": {
              "nameLabel": "guest-tools.iso",
              "virtualSize": 71077888,
              "location": "guest-tools-7.11.0-1.iso",
              "SR": {
                "nameLabel": "XenServer Tools",
                "contentType": "iso"
              }
            }
          }
        ]
      }
    ]
  }
}
Clone this wiki locally