[ 
https://issues.apache.org/jira/browse/AMBARI-3849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13829609#comment-13829609
 ] 

Tom Beerbower commented on AMBARI-3849:
---------------------------------------

To get a minimal response, use the query string parameter 
*minimal_response=true*.  This will remove all hrefs from the response.  In 
addition, only minimal resource id fields and explicitly requested fields will 
be returned.

For example, the normal request ...
{code}
/api/v1/clusters/c1/hosts?fields=Hosts/host_status,host_components/HostRoles/state

{
  "href" : 
"http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/hosts?fields=Hosts/host_status,host_components/HostRoles/state";,
  "items" : [
    {
      "href" : 
"http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6401.ambari.apache.org";,
      "Hosts" : {
        "cluster_name" : "c1",
        "host_name" : "c6401.ambari.apache.org",
        "host_status" : "HEALTHY"
      },
      "host_components" : [
        {
          "href" : 
"http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/hosts/c6401.ambari.apache.org/host_components/DATANODE";,
          "HostRoles" : {
            "cluster_name" : "c1",
            "component_name" : "DATANODE",
            "host_name" : "c6401.ambari.apache.org",
            "state" : "STARTED"
          }
        },
...
      ]
    }
  ]
}
{code}


will look like this with *minimal_response=true* ...

{code}
/api/v1/clusters/c1/hosts?fields=Hosts/host_status,host_components/HostRoles/state&minimal_response=true

{
  "items" : [
    {
      "Hosts" : {
        "host_name" : "c6401.ambari.apache.org",
        "host_status" : "HEALTHY"
      },
      "host_components" : [
        {
          "HostRoles" : {
            "component_name" : "DATANODE",
            "state" : "STARTED"
          }
        },
...
      ]
    }
  ]
}
{code}

> Need ability to filter out href field in requests
> -------------------------------------------------
>
>                 Key: AMBARI-3849
>                 URL: https://issues.apache.org/jira/browse/AMBARI-3849
>             Project: Ambari
>          Issue Type: Task
>            Reporter: Tom Beerbower
>            Assignee: Tom Beerbower
>
> On some API requests on large clusters, half the time is spent in generating, 
> and half the time in transporting content. To cut down on the amount of 
> content transported, we need a way to filter out the 'href' field.
> On a 2MB hosts response, 0.5MB is just the hrefs field.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to