<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Partial Request and Ambari REST API in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Partial-Request-and-Ambari-REST-API/m-p/106914#M21647</link>
    <description>&lt;P&gt;Hello everyone, &lt;/P&gt;&lt;P&gt;I am trying to get a list of alerts via REST API but I want it to be limited to only specific fields.&lt;/P&gt;&lt;P&gt;I am currently able to get all available information from the alerts, ie:&lt;/P&gt;&lt;PRE&gt;{
  "href" : "http://ambari_server:8080/api/v1/clusters/appslogs/alerts?Alert/state.in(WARNING,CRITICAL,UNKNOWN)&amp;amp;Alert/maintenance_state=OFF&amp;amp;fields=*",
  "items" : [
    {
      "href" : "http://ambari_server:8080/api/v1/clusters/appslogs/alerts/23",
      "Alert" : {
        "cluster_name" : "appslogs",
        "component_name" : "AMBARI_AGENT",
        "definition_id" : 50,
        "definition_name" : "ambari_agent_disk_usage",
        "host_name" : "host1.local",
        "id" : 23,
        "instance" : null,
        "label" : "Host Disk Usage",
        "latest_timestamp" : 1456931060177,
        "maintenance_state" : "OFF",
        "original_timestamp" : 1454589680156,
        "scope" : "HOST",
        "service_name" : "AMBARI",
        "state" : "WARNING",
        "text" : "Capacity Used: [71.56%, 6.0 GB], Capacity Total: [8.3 GB], path=/usr/hdp. Total free space is less than 2.0 GB"
      }&lt;/PRE&gt;&lt;P&gt;Does anybody know how to get ONLY state,host and text fields in response?&lt;/P&gt;&lt;P&gt;I tried the following request but it does not work:&lt;/P&gt;&lt;PRE&gt;&lt;A href="http://ambari_server:8080/api/v1/clusters/appslogs/alerts?Alert/state.in(WARNING,CRITICAL,UNKNOWN)&amp;amp;Alert/maintenance_state=OFF&amp;amp;fields=state,host,text" target="_blank"&gt;http://ambari_server:8080/api/v1/clusters/appslogs/alerts?Alert/state.in(WARNING,CRITICAL,UNKNOWN)&amp;amp;Alert/maintenance_state=OFF&amp;amp;fields=state,host,text&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;What am I missing? &lt;/P&gt;&lt;P&gt;Apache Ambari
Version: 2.2.0.0&lt;/P&gt;</description>
    <pubDate>Wed, 02 Mar 2016 23:10:14 GMT</pubDate>
    <dc:creator>alexzagor</dc:creator>
    <dc:date>2016-03-02T23:10:14Z</dc:date>
    <item>
      <title>Partial Request and Ambari REST API</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Partial-Request-and-Ambari-REST-API/m-p/106914#M21647</link>
      <description>&lt;P&gt;Hello everyone, &lt;/P&gt;&lt;P&gt;I am trying to get a list of alerts via REST API but I want it to be limited to only specific fields.&lt;/P&gt;&lt;P&gt;I am currently able to get all available information from the alerts, ie:&lt;/P&gt;&lt;PRE&gt;{
  "href" : "http://ambari_server:8080/api/v1/clusters/appslogs/alerts?Alert/state.in(WARNING,CRITICAL,UNKNOWN)&amp;amp;Alert/maintenance_state=OFF&amp;amp;fields=*",
  "items" : [
    {
      "href" : "http://ambari_server:8080/api/v1/clusters/appslogs/alerts/23",
      "Alert" : {
        "cluster_name" : "appslogs",
        "component_name" : "AMBARI_AGENT",
        "definition_id" : 50,
        "definition_name" : "ambari_agent_disk_usage",
        "host_name" : "host1.local",
        "id" : 23,
        "instance" : null,
        "label" : "Host Disk Usage",
        "latest_timestamp" : 1456931060177,
        "maintenance_state" : "OFF",
        "original_timestamp" : 1454589680156,
        "scope" : "HOST",
        "service_name" : "AMBARI",
        "state" : "WARNING",
        "text" : "Capacity Used: [71.56%, 6.0 GB], Capacity Total: [8.3 GB], path=/usr/hdp. Total free space is less than 2.0 GB"
      }&lt;/PRE&gt;&lt;P&gt;Does anybody know how to get ONLY state,host and text fields in response?&lt;/P&gt;&lt;P&gt;I tried the following request but it does not work:&lt;/P&gt;&lt;PRE&gt;&lt;A href="http://ambari_server:8080/api/v1/clusters/appslogs/alerts?Alert/state.in(WARNING,CRITICAL,UNKNOWN)&amp;amp;Alert/maintenance_state=OFF&amp;amp;fields=state,host,text" target="_blank"&gt;http://ambari_server:8080/api/v1/clusters/appslogs/alerts?Alert/state.in(WARNING,CRITICAL,UNKNOWN)&amp;amp;Alert/maintenance_state=OFF&amp;amp;fields=state,host,text&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;What am I missing? &lt;/P&gt;&lt;P&gt;Apache Ambari
Version: 2.2.0.0&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2016 23:10:14 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Partial-Request-and-Ambari-REST-API/m-p/106914#M21647</guid>
      <dc:creator>alexzagor</dc:creator>
      <dc:date>2016-03-02T23:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: Partial Request and Ambari REST API</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Partial-Request-and-Ambari-REST-API/m-p/106915#M21648</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/3164/alexzagor.html" nodeid="3164"&gt;@Sunella Zag&lt;/A&gt; It looks like alerts resource doesn't allow filtering of fields. Only fields=* seems to be working. Specifying any fields results in default fields.&lt;/P&gt;&lt;PRE&gt;&lt;A href="http://ambari_server:8080/api/v1/clusters/appslogs/alerts?Alert/state.in(WARNING,CRITICAL,UNKNOWN)&amp;amp;Alert/maintenance_state=OFF&amp;amp;fields=Alert/state,Alert/host,Alert/text" target="_blank"&gt;http://ambari_server:8080/api/v1/clusters/appslogs/alerts?Alert/state.in(WARNING,CRITICAL,UNKNOWN)&amp;amp;Alert/maintenance_state=OFF&amp;amp;fields=Alert/state,Alert/host,Alert/text&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;For services resource, I was able to specify a list of fields and get only required fields in my response.&lt;/P&gt;&lt;PRE&gt;&lt;A href="http://ambari_server:8080/api/v1/clusters/hdp_dev/services/HDFS?fields=alerts_summary" target="_blank"&gt;http://ambari_server:8080/api/v1/clusters/hdp_dev/services/HDFS?fields=alerts_summary&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;so this seems to be a problem only with alert resource.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2016 09:01:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Partial-Request-and-Ambari-REST-API/m-p/106915#M21648</guid>
      <dc:creator>shishir_saxena4</dc:creator>
      <dc:date>2016-03-03T09:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: Partial Request and Ambari REST API</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Partial-Request-and-Ambari-REST-API/m-p/106916#M21649</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/3164/alexzagor.html" nodeid="3164"&gt;@Sunella Zag&lt;/A&gt; Following fields are defaults and will be included in all responses&lt;/P&gt;&lt;PRE&gt;"cluster_name" , "definition_id", "definition_name" , "host_name" , "id" , "service_name" &lt;/PRE&gt;&lt;P&gt;You can include any additional fields using&lt;/P&gt;&lt;PRE&gt;&lt;A href="http://ambari_server:8080/api/v1/clusters/appslogs/alerts?Alert/state.in%28WARNING,CRITICAL,UNKNOWN%29&amp;amp;Alert/maintenance_state=OFF&amp;amp;fields=state,host,text"&gt;http://ambari_server:8080/api/v1/clusters/appslogs/alerts?Alert/state.in(WARNING,CRITICAL,UNKNOWN)&amp;amp;Alert/maintenance_state=OFF&amp;amp;fields=A&lt;/A&gt;lert/state,Alert/text&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Mar 2016 02:05:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Partial-Request-and-Ambari-REST-API/m-p/106916#M21649</guid>
      <dc:creator>shishir_saxena4</dc:creator>
      <dc:date>2016-03-04T02:05:28Z</dc:date>
    </item>
  </channel>
</rss>

