<?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>topic Re: Morpheus Approval API in HPE Morpheus Enterprise Software</title>
    <link>https://community.hpe.com/t5/hpe-morpheus-enterprise-software/morpheus-approval-api/m-p/7249950#M3124</link>
    <description>&lt;P&gt;&lt;A class="mention" href="https://community.hpe.com/u/tyler_boyd"&gt;@Tyler_Boyd&lt;/A&gt;  - I want the filter like needs to retrieve only requested approval items not approved one. Let’s take the example I wants to know how many approval items are not yet approved. For this I need to hit the Retrieves all Approvals Api from that response I need to filter it accordingly. But in this case every time we need to play with huge number of data avoiding this if we have the filter in the API itself will be easy.&lt;/P&gt;</description>
    <pubDate>Fri, 27 Oct 2023 16:39:41 GMT</pubDate>
    <dc:creator>Ibrahim-GCC</dc:creator>
    <dc:date>2023-10-27T16:39:41Z</dc:date>
    <item>
      <title>Morpheus Approval API</title>
      <link>https://community.hpe.com/t5/hpe-morpheus-enterprise-software/morpheus-approval-api/m-p/7249947#M3121</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;
&lt;P&gt;Is there any way to fetch only requested approval items from approvals. As I seen the API docs it is fetching the entire list from that list we need to filter the requested one each time its fetching the huge list of items. So, I want to know is there a way to hit and retrieve only requested item using API.&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;
Ibrahim K&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2023 07:36:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-morpheus-enterprise-software/morpheus-approval-api/m-p/7249947#M3121</guid>
      <dc:creator>Ibrahim-GCC</dc:creator>
      <dc:date>2023-10-27T07:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: Morpheus Approval API</title>
      <link>https://community.hpe.com/t5/hpe-morpheus-enterprise-software/morpheus-approval-api/m-p/7249948#M3122</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;How are you wanting to filter the approvals?&lt;/P&gt;
&lt;P&gt;Per the API docs, you can specify an approval ID if you only need information on a single approval.&lt;/P&gt;
&lt;P&gt;This request will give you the most information on the approval&lt;BR /&gt;
&lt;A href="https://apidocs.morpheusdata.com/reference/getapprovals" class="onebox" target="_blank" rel="noopener"&gt;https://apidocs.morpheusdata.com/reference/getapprovals&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;This request will get items under “approvalItems” in the JSON&lt;BR /&gt;
&lt;A href="https://apidocs.morpheusdata.com/reference/getapprovalsitem" class="onebox" target="_blank" rel="noopener"&gt;https://apidocs.morpheusdata.com/reference/getapprovalsitem&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2023 13:17:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-morpheus-enterprise-software/morpheus-approval-api/m-p/7249948#M3122</guid>
      <dc:creator>tyboyd</dc:creator>
      <dc:date>2023-10-27T13:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: Morpheus Approval API</title>
      <link>https://community.hpe.com/t5/hpe-morpheus-enterprise-software/morpheus-approval-api/m-p/7249949#M3123</link>
      <description>&lt;P&gt;JSONPath is quite powerful for filtering. For your use-case, something like this may give you what you’re looking for:&lt;/P&gt;
&lt;PRE style="background : #f0f1f2;"&gt;&lt;CODE class="lang-auto"&gt;import requests
import json
from jsonpath_ng import jsonpath
from jsonpath_ng.ext import parse
import warnings 

warnings.filterwarnings("ignore")

url = "https://{MORPHEUS-APPLIANCE-URL}/api/approvals?max=100&amp;amp;offset=0&amp;amp;sort=name&amp;amp;direction=asc"

headers = {
    "accept": "application/json",
    "authorization": "Bearer {MORPHEUS-API-KEY}"
}

response = requests.get(url, headers=headers, verify=False)
data = response.json()

requestedApprovalsQuery = parse("$.approvals[?(@.status[*] = '1 requested')]")       # only retrieve approvals with a status of 'requested'
requestedApprovals = [match.value for match in requestedApprovalsQuery.find(data)]

print(json.dumps(requestedApprovals, indent=2))
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To print the number of items awaiting approval:&lt;/P&gt;
&lt;PRE style="background : #f0f1f2;"&gt;&lt;CODE class="lang-auto"&gt;print(f"Number of items awaiting approval: {len(requestedApprovals)}")
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I arbitrarily set the &lt;STRONG&gt;max&lt;/STRONG&gt; to &lt;STRONG&gt;100&lt;/STRONG&gt; but you can change that based on your requirements&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2023 17:32:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-morpheus-enterprise-software/morpheus-approval-api/m-p/7249949#M3123</guid>
      <dc:creator />
      <dc:date>2023-10-27T17:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Morpheus Approval API</title>
      <link>https://community.hpe.com/t5/hpe-morpheus-enterprise-software/morpheus-approval-api/m-p/7249950#M3124</link>
      <description>&lt;P&gt;&lt;A class="mention" href="https://community.hpe.com/u/tyler_boyd"&gt;@Tyler_Boyd&lt;/A&gt;  - I want the filter like needs to retrieve only requested approval items not approved one. Let’s take the example I wants to know how many approval items are not yet approved. For this I need to hit the Retrieves all Approvals Api from that response I need to filter it accordingly. But in this case every time we need to play with huge number of data avoiding this if we have the filter in the API itself will be easy.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2023 16:39:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-morpheus-enterprise-software/morpheus-approval-api/m-p/7249950#M3124</guid>
      <dc:creator>Ibrahim-GCC</dc:creator>
      <dc:date>2023-10-27T16:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: Morpheus Approval API</title>
      <link>https://community.hpe.com/t5/hpe-morpheus-enterprise-software/morpheus-approval-api/m-p/7249951#M3125</link>
      <description>&lt;P&gt;&lt;A class="mention" href="https://community.hpe.com/u/ibrahim"&gt;@ibrahim&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;If you’re interested in having the filter added, consider submitting an idea. Based on discussions with the team, this shouldn’t be a difficult thing to add but submitting an idea is the most effective way to influence future releases. Don’t forget to vote for your own idea!&lt;/P&gt;
&lt;ASIDE class="onebox category-onebox" style="box-shadow: -5px 0px #c3e3f3;"&gt;
  &lt;ARTICLE class="onebox-body category-onebox-body"&gt;
      &lt;DIV class="aspect-image" style="--aspect-ratio:140/140;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="78d8be134643fb51cac8219ea3fdaef247610f82.png"&gt;&lt;img src="https://community.hpe.com/t5/image/serverpage/image-id/149632iF3DE4C99F63A9C15/image-size/large?v=v2&amp;amp;px=2000" role="button" title="78d8be134643fb51cac8219ea3fdaef247610f82.png" alt="78d8be134643fb51cac8219ea3fdaef247610f82.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;
    &lt;H3&gt;
      &lt;A class="badge-wrapper bullet" href="https://community.hpe.com/c/ideas/15"&gt;
          &lt;SPAN class="badge-category-bg" style="background-color: #c3e3f3"&gt;&lt;/SPAN&gt;
        &lt;SPAN class="clear-badge"&gt;&lt;SPAN&gt;Ideas&lt;/SPAN&gt;&lt;/SPAN&gt;
      &lt;/A&gt;
    &lt;/H3&gt;
      &lt;DIV&gt;
        &lt;SPAN class="description"&gt;
          &lt;P&gt;Ideas is an opportunity for the community to voice their desired functionality with the Morpheus platform.  Topics will be reviewed prior to posting to ensure safety for the customer(s).  Once posted, users can vote for topics they are in favor of.  There are a limited number of votes that can be cast based on your forum ranking until a topic is closed or a vote is rescinded&lt;/P&gt;
        &lt;/SPAN&gt;
      &lt;/DIV&gt;
  &lt;/ARTICLE&gt;
  &lt;DIV class="clearfix"&gt;&lt;/DIV&gt;
&lt;/ASIDE&gt;</description>
      <pubDate>Fri, 27 Oct 2023 19:15:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-morpheus-enterprise-software/morpheus-approval-api/m-p/7249951#M3125</guid>
      <dc:creator>tyboyd</dc:creator>
      <dc:date>2023-10-27T19:15:20Z</dc:date>
    </item>
  </channel>
</rss>

