- Community Home
- >
- Software
- >
- HPE OneView
- >
- Delete server hard via REST API?
-
- 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
04-30-2019 06:49 AM
04-30-2019 06:49 AM
I'm trying to figure out how to remove a server from OpenView through the REST API. I see POST https://{appl}/rest/server-hardware for adding a server, but don't see anything specific to deleting a server. Does anyone know the correct call for that?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
04-30-2019 02:22 PM
04-30-2019 02:22 PM
SolutionI am an HPE employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
05-01-2019 02:13 AM
05-01-2019 02:13 AM
Re: Delete server hard via REST API?
Hi Chris,
I am logged into our OpenView and pulled up the REST API reference. Looking at the Server Hardware page, I see GET, PUT, PATCH, and POST, but there is no DELETE documented. My systems are all Linux. So, using curl and the REST API, not powershell. I'll do a GET /rest/server-hardware to get a current listing. Then, I'll try the DELETE /rest/server-hardware/{UUID} and see how that works? Might need an engineering change request to update the documentation. :)
Regards,
Brad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
05-01-2019 03:09 AM
05-01-2019 03:09 AM
Re: Delete server hard via REST API?
Can report that this worked:
UUID=3738638-3330-5536-4F38-323836433D33 DELURI=$(curl --insecure \ --header "auth: ${sessionID}" \ --header "X-API-Version: ${currentVersion}" \ --request DELETE ${OneView}/rest/server-hardware/${UUID} | jq -r ".uri") curl --insecure \ --header "auth: ${sessionID}" \ --header "X-API-Version: ${currentVersion}" \ --request GET ${OneView}${DELURI} | jq -r '.'
Thanks Chris. Please make sure they update the REST API reference! :)
Regards,
Brad V
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-10-2019 02:16 AM
12-10-2019 02:16 AM
Re: Delete server hard via REST API?
HI Chris,
I just checked in the vs 1200 API reference and I still can't find this documented. Also, the deletion command is working, but I'm not getting any return. No deletion task uri or anything.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-12-2019 09:23 AM
12-12-2019 09:23 AM
Re: Delete server hard via REST API?
The task URI will be in the HTTP headers of the responce. As I have stated in other threads, you need to look at the HTTP response code from the cURL call. If it is HTTP 202, then you need to look for the Location HTTP header, which will contain the task URI.
I am an HPE employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-12-2019 09:24 AM
12-12-2019 09:24 AM
Re: Delete server hard via REST API?
Also, as for the REST API reference documentation, I am looking into it.
I am an HPE employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-24-2019 07:46 AM
12-24-2019 07:46 AM
Re: Delete server hard via REST API?
Sorry, was floating in the Caribbean.
I think I got it worked out. To delete:
# To delete a server
UUID=3738638-3330-5536-4F38-323836433D33
declare -a RESPONS
RESPONS=($(curl --insecure \
--header "auth: ${sessionID}" \
--header "X-API-Version: ${currentVersion}" \
--include \
--request DELETE ${OneView}/rest/server-hardware/${UUID} | grep -E '^HTTP|^Location'))
if [[ ${RESPONS[1]} -eq 202 ]]; then
# Accepted
DELURI=${RESPONS[4]}
# Check the deletion task status:
curl --insecure \
--header "auth: ${sessionID}" \
--header "X-API-Version: ${currentVersion}" \
--request GET ${OneView}${DELURI} | jq -r '.'
else
echo rejected
fi
unset RESPONS
To add:
# To add a server:
SERVER="my-hostname-ilo.my.org"
declare -a RESPONS
RESPONS=($(curl --insecure \
--"content-type: application/json" \
--header "auth: ${sessionID}" \
--header "X-API-Version: ${currentVersion}" \
--include \
--data "{ \"hostname\": \"${SERVER}\", \"username\": \"Administrator\", \"password\": \"${PASSW}\", \"force\": false, \"licensingIntent\": \"OneView\", \"configurationState\": \"Managed\", \"initialScopeUris\": []}' \
--request POST ${OneView}/rest/server-hardware | grep -E '^HTTP|^Location'))
if [[ ${RESPONS[1]} -eq 202 ]]; then
# Accepted
ADDURI=${RESPONS[4]}
# Check the addition task status:
curl --insecure \
--header "auth: ${sessionID}" \
--header "X-API-Version: ${currentVersion}" \
--request GET ${OneView}${ADDURI} | jq -r '.'
else
echo rejected
fi
unset RESPONS
This seems to be working. Thanks!
Hewlett Packard Enterprise International
- Communities
- HPE Blogs and Forum
© Copyright 2021 Hewlett Packard Enterprise Development LP