This works as expected. After that I wanna accept the changes via the API.
I tried executing the discovery check via the subsequent command:
Invoke-RestMethod -Headers $API_headers -Method Post -Uri "$API_URL/domain-types/activation_run/actions/activate-changes/invoke"
This gives me the subsequent Error Message:
"title": "Precondition required", "status": 428, "detail": "If-Match header required for this operation. See documentation."
I looked into the documentation and there it states, that I need the objects E-Tag header. If I try to read out the information of the host with the subsequent command, I can’t seem to find an E-Tag Header:
Invoke-RestMethod -Headers $API_headers -Method Get -Uri "$API_URL/domain-types/service/collections/all?host_name=$HostName"
Does anybody have the same problem or know how to fix this problem? Is there maybe an alternative way to execute the accepting of the changes or could it have something to do with my CheckMK Version?
inside your header lines.
For the activation of changes you don’t need an specific etag this is only important if you change an object (host/rules and so on).
Well, for anyone is stuck on this. The following fixed it for me. I make an api call to : api/1.0/domain-types/activation_run/collections/pending_changes and get the Etag header value from there and use it in my activation POST.
The document is a little bit vague about this, because it reads like: You can use everything you want basicly. But it should match and is important.