hosts.md 2.0 KB

List Hosts

Back to Resources

Summary

Returns a collection of all hosts for the cluster identified by ":clusterName".

GET /clusters/:clusterName/hosts

Response

<th>HTTP CODE</th>
<th>Description</th>

<td>200</td>
<td>OK</td>  

<td>400</td>
<td>Bad Request</td>  

<td>401</td>
<td>Unauthorized</td>  

<td>403</td>
<td>Forbidden</td>  

<td>404</td>
<td>Not Found</td>  

<td>500</td>
<td>Internal Server Error</td>  

Example

Get the collection of the hosts for the cluster named "c1".

GET /clusters/c1/hosts

200 OK
{
    "href" : "http://your.ambari.server/api/v1/clusters/c1/hosts/",
    "items" : [
        {
            "href" : "http://your.ambari.server/api/v1/clusters/c1/hosts/host1",
            "Hosts" : {
                "cluster_name" : "c1",
                "host_name" : "host1"
            }
        },
        {
            "href" : "http://your.ambari.server/api/v1/clusters/c1/hosts/host2",
            "Hosts" : {
                "cluster_name" : "c1",
                "host_name" : "host2"
            }
        }
    ]
}