Nav
You are viewing an older version of this section. Click here to navigate to the latest version.

List All Servers

The resource /mmc/api/servers, invoked via the HTTP GET operation, returns a list of all servers on the specified resource. The JSON returned by the resource contains two properties: total, which specifies the number of total servers, and data, which is an array of server types.

Parameters

The resource takes the following parameters. Notice that the first two parameters have default values, and thus may be omitted. The other two parameters are optional.

Query Parameters:

Name Description

start

The server index to start listing at. Defaults to 0.

count

The number of servers to return. Defaults to 100.

name

The name of the server to search for. Optional.

redirectToResult

Used in conjunction with name to redirect to the server if there is one with the corresponding name. Valid values are true/false. Optional.

Request/Response Examples

The following examples illustrate sample requests to the resource and typical responses. The first request shows how to invoke the resource with no parameters and the JSON result that is returned.

Example #1 Request

This first request shows how to invoke the resource with no parameters. When invoked with no parameters, the method returns a complete JSON result, that is, with all data field values.

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

Example #1 Response


          
       
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
200 OK
Content-Type: application/json
Server: Apache-Coyote/1.1
Date: Sun, 08 Nov 2009 00:12:55 GMT
{
  "total" : 1,
  "data" : [
    {
      "name" : "Test",
      "id" : "local$b15ecba1-9f97-4b16-8127-9b137cdbb2e1",
      "href" : "http://localhost:9003/mmc/api/servers/local$b15ecba1-9f97-4b16-8127-9b137cdbb2e1",
      "agentUrl" : "https://localhost:7777/mmc-support",
      "hostIp" : "192.168.0.13",
      "muleServerId" : "d9505d40-2c5c-11df-b832-a32a5a09ec4e",
      "started" : "Wed Mar 10 16:51:59 CET 2010",
      "version" : "2.2.5",
      "agents": [
        {
          "name" : "mmc-support",
          "description" : "Mule Management Console Support (0.0.0.0:7777)"
        },
        {
          "name" : "jmx-agent",
          "description" : "JMX Agent"
         }
       ],
      "groups" : [
        {
          "name" : "Development",
          "href" : "http://localhost:8080/mmc/api/serverGroups/73d89173-290e-4cb3-a61c-e11deb74767d"
        }
      ],
      "runningServices" : 3,
      "pausedServices" : 0,
      "stoppedServices": 0
    }
  ]
}

Example #2 Request

This form of the request shows how you might specify the optional name parameter to retrieve only the server identifier with the designated name.

GET http://localhost:8080/mmc/api/servers?name=MyServer&redirectOnResult=true

Example #2 Response

The JSON result in the response only contains the matching server id.

301
Location: http://localhost:8080/mmc/api/servers/serverId