- Community Home
- >
- Software
- >
- HPE Morpheus Software
- >
- HPE Morpheus Enterprise Software
- >
- Morpheus Approval API
Categories
Company
Local Language
Forums
Discussions
- Integrity Servers
- Server Clustering
- HPE NonStop Compute
- HPE Apollo Systems
- High Performance Computing
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Knowledge Base
Forums
Discussions
- Cloud Mentoring and Education
- Software - General
- HPE OneView
- HPE Ezmeral Software platform
- HPE OpsRamp Software
Knowledge Base
Discussions
Forums
Discussions
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
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
I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
- 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!
I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]