Delete attribute (like custom var) via API



I’ve added a custom var via api to an already existing host, like this:
curl -k -s -u user:pass -H 'Accept: application/json' -X POST '' -d '{ "attrs": {"vars.testvar.0" : "Something"} }

This was working great, but how can I remove this custom var?

(Aflatto) #2

Have you tried

curl -k -s -u user:pass -H ‘Accept: application/json’ -X POST ‘’ -d '{ “attrs”: {“vars.testvar.0” : null} }


Yes. The custom var, then, is still there, but is empty. Unfortuately not deleted…

(Aflatto) #4

did you try DELETE instead of POST ?

Be careful as it might delete the whole object


Unfortunately also isn’t woking. As you expected, it will only try to delete the hole object. Luckily it isn’t able to do this, because everything except the custom var was created using the config. And thats why I’m only getting this:
Object cannot be deleted because it was not created using the API