HPE OneView
cancel
Showing results for 
Search instead for 
Did you mean: 

Delete server hard via REST API?

 
SOLVED
Go to solution
BradV
Valued Contributor

Delete server hard via REST API?

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?

3 REPLIES 3
ChrisLynchHPE
Neighborhood Moderator
Solution

Re: Delete server hard via REST API?

You would use DELETE /rest/server-hardware/{UUID}. This is documented in our REST API documentation. You could also use our language bindings or scripting SDK's like PowerShell or Python, which include options or examples to remove resources like server hardware.

Accept or Kudo

BradV
Valued Contributor

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

BradV
Valued Contributor

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