Contact Us 1-800-596-4880

List All Server Groups

The resource /mmc/api/serverGroups, when used with the HTTP GET operation, returns a list of all the server groups on the resource.

The response includes a JSON class that contains two properties of particular interest:

  • total - The total number of server groups.

  • data - An array of server group types. The array includes the following fields for each server group:

    • name - The identifying name of the server group.

    • id - The server group identifier.

    • serverCount - The number of servers in the server group.

    • href - The URL to the server group.

Parameters

You can specify a name parameter with this resource. Specifying a server group name limits the response to the server group whose name matches the supplied name value. The response includes only the server group identifier.

Invoke the resource as follows: /mmc/api/serverGroupd&name=<myServerGroupName>, substituting the name of the server group for <myServerGroupName>.

You may also redirect the results by appending the following code after the server group name value: &redirectOnResult=true. The second example request below illustrates this form of the request.

Example Requests

The following are two example requests illustrating how to use this resource. The first example calls the resource with no parameters, while the second request makes the call with parameters.

Example #1 Request
This example calls the resource with no parameters.

GET http://localhost:8080/mmc/api/serverGroups

Example #1 Response:

200 OK
Content-Type: application/json
Server: Apache-Coyote/1.1
Date: Sun, 08 Nov 2009 00:12:55 GMT
{
  "total" : 1,
  "data" : [
    {
      "name" : "NewGroupName",
      "id" : "73d89173-290e-4cb3-a61c-e11deb74767d",
      "serverCount" : 0,
      "href" : "http://localhost:8080/mmc/api/serverGroups/73d89173-290e-4cb3-a61c-e11deb74767d"
    }
  ]
}

Example #2 Request:
This example invokes the resource and specifies a server group name. It also includes a directive to redirect the results.

GET http://localhost:8080/mmc/api/serverGroups?name=MyServerGroup&redirectOnResult=true

Example #1 Response:

301 Location: http://localhost:8080/mmc/api/serverGroups/serverGroupId