- Community Home
- >
- Software
- >
- HPE Morpheus Software
- >
- HPE Morpheus Enterprise
- >
- Option Lists : REST APIs - Pass dynamic parameter ...
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
06-12-2023 11:58 PM
06-12-2023 11:58 PM
Morpheus should have feature to add Dynamic Param in Source URL for Rest API
Below scenario can explain this in more details.
- We have created one catalog item for adding tags on cluster node (worker)
- As per attachment, we have one dropdown to select cluster.
- We have another dropdown to list all nodes (workers). Our requirement is : When we select cluster from first dropdown, second dropdown should auto-populate workers for the selected cluster
- We are using this API to achieve this - /api/clusters/clusterId/workers \
- Here in above API, clusterId is a dynamic parameter which needs to be passed from cluster selection.
- As per the screenshot attached, we are using REST api for this.
- We don’t find any way to pass clusterID in Source URL.
- We need support here.
Solved! Go to Solution.
- Tags:
- API
- automation
- catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2023 11:45 PM
06-14-2023 11:45 PM
Re: Option Lists : REST APIs - Pass dynamic parameter in source URL
@Ollie_Phillips With some changes, the approach worked for me. Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2023 05:16 AM
06-13-2023 05:16 AM
Re: Option Lists : REST APIs - Pass dynamic parameter in source URL
Hi yes, can see how that would be useful. Please consider also proposing this in the ideas section of this forum. Ideas there are tracked and voted on.
In the absence of the ability to do that, I do think you can still achieve your goal.
The clusters API response contains all clusters, if you pass your selected cluster id to the next option list, you could make the same call for all clusters again in that option list and parse out the workers (which are apart of the response, and certainly include name
and id
for your select box control) from the cluster previously selected using a translation script. The workers are listed under servers
in the JSON response but note this also includes the master, so that will need to be filtered out in the translation script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2023 05:40 AM
06-13-2023 05:40 AM
SolutionThis translation script achieves the above, parsing the data you need from clusters api response only:
// assumes input which provides cluster id is called clusterID)
let results = [];
let clusters = data["clusters"] ;
for(let i = 0; i < clusters.length; i++){
if (clusters[i].id == input.clusterID) {
// we've matched our cluster
let servers = clusters[i]["servers"];
for (let i2 = 0; i2 < servers.length; i2++) {
// iterate the servers (master and workers)
if(servers[i2]["computeServerType"]["nodeType"]=="kube-worker"){
// its a worker build data for select
let workerName = servers[i2]["name"];
let workerId = servers[i2]["id"];
results.push({name: workerName,value: workerId});
}
}
}
}
Results array passed to the select node control
[
{ name: 'MKS 1-worker-1', value: 14 },
{ name: 'MKS 1-worker-3', value: 16 },
{ name: 'MKS 1-worker-2', value: 15 }
]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2023 06:17 AM
06-13-2023 06:17 AM
Re: Option Lists : REST APIs - Pass dynamic parameter in source URL
Thank you for your response and explaination first of all.
My question is : What will be the source URL for listing all workers / Nodes?
SOURCE URL <>/api/clusters/97/workers
Right now, this 97 is my cluster ID. How would it be possible to update this value? How my cluster ID will get overridden?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2023 06:38 AM
06-13-2023 06:38 AM
Re: Option Lists : REST APIs - Pass dynamic parameter in source URL
If I understood the ask correctly, the solution above negates the need for you to make that call to get the workers on a specific cluster ID. i.e /api/clusters/97/workers
You will call api/clusters
again instead, and the above translation script will take/receive all clusters, filter on the cluster ID passed from the cluster select control (e.g 97) and then present all the workers of that cluster for use in the node/worker select input.