Can you create labels with the WebAPI Edit Host command

Hi , i was wondering of you can create labels on a host with the WebApi edit host command.
I am already doing something similar with Tags, but in some cases a label would be more useful than a tag.

At the moment i don’t know any API call for this, but it could also be that i missed something the last weeks :wink:

1 Like

Im still using 1.5, but you can try this:

if you create your hosts with webapi:

  1. to see the structure, create label and then use curl to get_host to see and check the structure:
    https://checkmk.de/cms_web_api_references.html#get_host

  2. when you see the structure, add the label part to the add_host:
    https://checkmk.de/cms_web_api_references.html#add_host

Well , yes , that’s along the line of what i was asking.
but it was could you add label definition in
https://checkmk.de/cms_web_api_references.html#edit_host
using the structure found in #get_host, because i would have to edit many existing hosts rather than create new ones with the labels.
I was asking here to see if anyone had already tried or knew if this would work.

you dont need create new hosts, you can use edit_host and add the label to it.
are the lables different from each-other or one for all ?
you can add the part of label to edit_host and check if its working…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.