- Community Home
- >
- Software
- >
- HPE OneView
- >
- Retrieve server hardware information with serverNa...
-
- Forums
-
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
- HPE Blog, Austria, Germany & Switzerland
- Blog HPE, France
- HPE Blog, Italy
- HPE Blog, Japan
- HPE Blog, Middle East
- HPE Blog, Russia
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
-
Blogs
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Blog, Latin America
- HPE Blog, Middle East
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
-
Information
- Community
- Welcome
- Getting Started
- FAQ
- Ranking Overview
- Rules of Participation
- Tips and Tricks
- Resources
- Announcements
- Email us
- Feedback
- Information Libraries
- Integrated Systems
- Networking
- Servers
- Storage
- Other HPE Sites
- Support Center
- Aruba Airheads Community
- Enterprise.nxt
- HPE Dev Community
- Cloud28+ Community
- Marketplace
-
Forums
-
Blogs
-
Information
-
English
- 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
- Email to a Friend
- Report Inappropriate Content
08-12-2019 04:04 AM
08-12-2019 04:04 AM
Is it possible to filter on serverName in the GET server-hardware API? I tried:
curl --insecure \
--header "auth: ${sessionID}" \
--header "X-API-Version: ${currentVersion}" \
--request GET ${OneView}/rest/server-hardware?serverName="my-host"
but I am getting much more than "my-host" in the return. I want to retrieve the UUID associated with this server to use in conjunction with create a new server profile for it. Just not sure of the best way to retrieve that?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-12-2019 08:01 AM
08-12-2019 08:01 AM
SolutionYou seem to be missing the ?filter= part of the request. In playing around with it just now, I found it impossible to get the quoting to go through curl correclty without transforming any special characters to the %xx equiv. (usuing postman returns this format when you ask for a command line equiv).
In my case, the request I was entering into postman is:
https://my-oneview/rest/server-hardware?filter="'serverName' eq 'myservername'"
Translated to a curl command ended up being:
'https://my-oneview/rest/server-hardware?filter=%22%27serverName%27%20eq%20%27myservername%27%22'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-12-2019 08:58 AM
08-12-2019 08:58 AM
Re: Retrieve server hardware information with serverName filter?
Great! That worked!
curl --insecure \
--header "auth: ${sessionID}" \
--header "X-API-Version: ${currentVersion}" \
--request GET ${OneView}/rest/server-hardware?filter=%22%27serverName%27%20=%20%27my-host%27%22 | jq -r '.'
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-12-2019 09:37 AM
08-12-2019 09:37 AM
Re: Retrieve server hardware information with serverName filter?
@DaveArko is correct. Almost every main URI supports the filter property, which is how you find an applicable resource using various object properties. Do keep in mind that not all properties can be used to filter. UserQuery is also another way you can find something. But UserQuery is also not fully supported by all URI's.
I am an HPE employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-12-2019 09:49 AM
08-12-2019 09:49 AM
Re: Retrieve server hardware information with serverName filter?
Hi Chris,
I'm trying to get a method from having a server profile template, using the new-profile API, then retrieving the UUID for a given server to modify the returned profile object before applying that to the server.
Regards,
Brad
Hewlett Packard Enterprise International
- Communities
- HPE Blogs and Forum
© Copyright 2021 Hewlett Packard Enterprise Development LP