- Community Home
- >
- Software
- >
- HPE Morpheus Software
- >
- HPE Morpheus Enterprise
- >
- Re: Morpheus Approval API
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2023 12:36 AM
10-27-2023 12:36 AM
Morpheus Approval API
Hi Team,
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.
Regards,
Ibrahim K
- Tags:
- API
- automation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2023 06:17 AM
10-27-2023 06:17 AM
Re: Morpheus Approval API
Hello,
How are you wanting to filter the approvals?
Per the API docs, you can specify an approval ID if you only need information on a single approval.
This request will give you the most information on the approval
https://apidocs.morpheusdata.com/reference/getapprovals
This request will get items under “approvalItems” in the JSON
https://apidocs.morpheusdata.com/reference/getapprovalsitem

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2023 10:32 AM
10-27-2023 10:32 AM
Re: Morpheus Approval API
JSONPath is quite powerful for filtering. For your use-case, something like this may give you what you’re looking for:
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&offset=0&sort=name&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))
To print the number of items awaiting approval:
print(f"Number of items awaiting approval: {len(requestedApprovals)}")
I arbitrarily set the max to 100 but you can change that based on your requirements
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2023 09:39 AM
10-27-2023 09:39 AM
Re: Morpheus Approval API
@Tyler_Boyd - 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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2023 12:15 PM
10-27-2023 12:15 PM
Re: Morpheus Approval API
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!