<?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 Re: How can I sort rest api response, I'm  looking  rest call for resource manager using curl in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-sort-rest-api-response-I-m-looking-rest-call-for/m-p/222555#M77372</link>
    <description>&lt;A rel="user" href="https://community.cloudera.com/users/47323/pmahesh.html" nodeid="47323"&gt;@Purna Chandra Mahesh Bhogavalli&lt;/A&gt;&lt;P&gt;There is no sort or order_by query parameter supported in the ResourceManager rest api. For your curl request, you can check the documentation at &lt;A href="http://hadoop.apache.org/docs/stable/hadoop-yarn/hadoop-yarn-site/ResourceManagerRest.html#Cluster_Applications_API"&gt;http://hadoop.apache.org/docs/stable/hadoop-yarn/hadoop-yarn-site/ResourceManagerRest.html#Cluster_Applications_API&lt;/A&gt;  &lt;/P&gt;&lt;P&gt;The only option now is to sort at the client side. For command line, one easy way is to install a tool called &lt;STRONG&gt;jq&lt;/STRONG&gt; &lt;A href="https://stedolan.github.io/jq/download/"&gt;https://stedolan.github.io/jq/download/&lt;/A&gt; if you are interested. For your use case, you can do something like follows:&lt;/P&gt;&lt;PRE&gt;curl -get "http://resource-manager-hostname:8088/ws/v1/cluster/apps?state=running&amp;amp;limit=20" | jq '.apps.app|sort_by(.queueUsagePercentage)'&lt;/PRE&gt;&lt;P&gt;For descending sort you can use,&lt;/P&gt;&lt;PRE&gt;curl -get "http://resource-manager-hostname:8088/ws/v1/cluster/apps?state=running&amp;amp;limit=20" | jq '.apps.app|sort_by(.queueUsagePercentage)|reverse'&lt;/PRE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Apr 2018 14:17:15 GMT</pubDate>
    <dc:creator>TarunParimi</dc:creator>
    <dc:date>2018-04-18T14:17:15Z</dc:date>
    <item>
      <title>How can I sort rest api response, I'm  looking  rest call for resource manager using curl</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-sort-rest-api-response-I-m-looking-rest-call-for/m-p/222554#M77371</link>
      <description>&lt;P&gt;Do we have sort option for resource manager when we access through curl rest api?&lt;/P&gt;&lt;P&gt;I'm using as below, but it is not resulting in sorted order.&lt;/P&gt;&lt;P&gt;curl -get "http://resource-manager-hostname:8088/ws/v1/cluster/apps?sort=queueUsagePercentage&amp;amp;order_by=asc&amp;amp;state=running&amp;amp;limit=20"&lt;/P&gt;&lt;P&gt;Can someone help here on this.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Purna Chandra Mahesh.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 18:16:12 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-sort-rest-api-response-I-m-looking-rest-call-for/m-p/222554#M77371</guid>
      <dc:creator>pmahesh</dc:creator>
      <dc:date>2018-04-17T18:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: How can I sort rest api response, I'm  looking  rest call for resource manager using curl</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-sort-rest-api-response-I-m-looking-rest-call-for/m-p/222555#M77372</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/47323/pmahesh.html" nodeid="47323"&gt;@Purna Chandra Mahesh Bhogavalli&lt;/A&gt;&lt;P&gt;There is no sort or order_by query parameter supported in the ResourceManager rest api. For your curl request, you can check the documentation at &lt;A href="http://hadoop.apache.org/docs/stable/hadoop-yarn/hadoop-yarn-site/ResourceManagerRest.html#Cluster_Applications_API"&gt;http://hadoop.apache.org/docs/stable/hadoop-yarn/hadoop-yarn-site/ResourceManagerRest.html#Cluster_Applications_API&lt;/A&gt;  &lt;/P&gt;&lt;P&gt;The only option now is to sort at the client side. For command line, one easy way is to install a tool called &lt;STRONG&gt;jq&lt;/STRONG&gt; &lt;A href="https://stedolan.github.io/jq/download/"&gt;https://stedolan.github.io/jq/download/&lt;/A&gt; if you are interested. For your use case, you can do something like follows:&lt;/P&gt;&lt;PRE&gt;curl -get "http://resource-manager-hostname:8088/ws/v1/cluster/apps?state=running&amp;amp;limit=20" | jq '.apps.app|sort_by(.queueUsagePercentage)'&lt;/PRE&gt;&lt;P&gt;For descending sort you can use,&lt;/P&gt;&lt;PRE&gt;curl -get "http://resource-manager-hostname:8088/ws/v1/cluster/apps?state=running&amp;amp;limit=20" | jq '.apps.app|sort_by(.queueUsagePercentage)|reverse'&lt;/PRE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 14:17:15 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-can-I-sort-rest-api-response-I-m-looking-rest-call-for/m-p/222555#M77372</guid>
      <dc:creator>TarunParimi</dc:creator>
      <dc:date>2018-04-18T14:17:15Z</dc:date>
    </item>
  </channel>
</rss>

