- Community Home
- >
- Software
- >
- HPE OneView
- >
- Re: Retrieve server hardware information with serv...
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
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
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
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
- 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
- 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
- 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
- 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2022 07:47 AM
08-02-2022 07:47 AM
Re: Retrieve server hardware information with serverName filter?
Did anything change in version 7 that might affect this? Our OneViews are at 7.00.00-0460837. When I run the above command (which used to work), I get back:
{
"type: "server-hardware-list-12",
"category": "server-hardware",
"count": 0,
"created": "<a date>",
"eTag": "16594505347",
"members": [],
"modified": "<another date>",
"nextPageUri": null,
"prevPageUri": null,
"start": 0,
"total": 0,
"uri": "/rest/server-hardware?filter=%22%27serverName%27%20=%20%27my-host%27%22&start=0&count=32"
}