- Community Home
- >
- Software
- >
- HPE OneView
- >
- Delete server hard via REST API?
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
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
- 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
- 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
- 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
- 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
- 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
- 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
- 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!