Skip to main content

getContainers

This method returns network containers. It will return an empty list if the parentId is not a container or does not contain any other container within it.

Services

This method requires you to place the {service} name in the API URL. The allowed services are:

  • computers, for "Computers and Virtual Machines"

  • virtualmachines, for "Virtual Machines"

  • mobile, for "Mobile Devices"

For example, the request URL for the mobile service is:

https://YOUR-HOSTNAME/api/v1.0/jsonrpc/network/mobile

Parameters

Parameter

Type

Optional

Description

parentId

String

Yes

The ID of the container. If null, the top containers of the specified service type will be returned.

viewType

Number

Yes

The ID of the view type for the virtual environment inventory. The view type depends on the virtualization platform. In VMWare integrations, the available options are:

  • 1 - Hosts and Clusters view (default)

  • 2 - Virtual Machines view.

In Citrix, XenServer integrations, the available options are:

  • 3 - Server view (default)

  • 4 - Folder view.

Return value

This method returns an Array containing a list of objects that represent the network containers. Each object has the following fields:

  • id - the ID of the container

  • name - the name of the container

Example

Request:

  {
       "params": {
           "parentId": "559bd17ab1a43d241b7b23c6",
           "viewType": 4
       },
       "jsonrpc": "2.0",
       "method": "getContainers",
       "id": "787b5e36-89a8-4353-88b9-6b7a32e9c87f"
  }  

Response:

  {
      "id": "787b5e36-89a8-4353-88b9-6b7a32e9c87f",
      "jsonrpc":"2.0",
      "result": [
              {
                  "id" : "5582c385b1a43deb7f7b23c6",
                  "name" : "Xen Server"
              } 
      ]
  }