Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

DELETE server from the instance

nishantpiyush
Kilo Contributor

I am using the below refrence to delete the server 

DELETE /now/cmdb/instance/{classname}/{sys_id}/relation/{rel_sys_id}

below is the curl commnad i am using 
curl "https://xyz.service-now.com/api/now/cmdb/instance/cmdb_ci_linux_server/412589b3db108514a7ee4b4913961..." \
--request DELETE \
--user 'xyz':'xyz'

below is the error i am getting 

{"error":{"message":"Relation with sys id '412589b3db108514a7ee4b4913961936' does not exist","detail":null},"status":"failure"}
Please help - i can connect over zoom to shocase the issue in more detail.


2 REPLIES 2

Niklas Peterson
Mega Sage

Hi,

The API endpoint is for deleting a CI relationship related to the server, not the server CI itself.

The error says there is no relationship with that sys_id.

 

Regards,

NIklas

 

Pratiksha
Mega Sage
Mega Sage

Use delete jobs.. Try in non prod first