diff --git a/doc/09-Automation.md b/doc/09-Automation.md index f993482e..5482c853 100644 --- a/doc/09-Automation.md +++ b/doc/09-Automation.md @@ -1,12 +1,14 @@ # Automation It is possible to issue command actions without a browser. To do so, a form needs to be submitted by a tool such as -cUrl. This is also used in the example below. +curl. This is also used in the example below. ## Request Format The request is required to be an Icinga Web API request. For this it is necessary to transmit the `Accept` HTTP header and set it to `application/json`. In addition to this, the request must be authenticated using the `Basic` schema. +The HTTP request method is `POST` if not documented otherwise and it might be necessary to manually configure this +(e.g. `-X POST` for curl). All endpoints support filters. To issue commands only for specific items, define a filter in the request's query string. If this filter is omitted, all items are affected. @@ -54,6 +56,14 @@ curl -H "Accept: application/json" -u $USER:$PASSWORD "$BASEURL/icingadb/hosts/a -F "comment=kaput" -F "expire_time=2023-10-05T20:00:00" -F "expire=y" ``` +```shell +USER="icingaadmin" +PASSWORD="icinga" +BASEURL="http://localhost/icingaweb2" +FILTER="host.name=docker-master" +curl -H "Accept: application/json" -u $USER:$PASSWORD -X POST "$BASEURL/icingadb/hosts/delete-comment?$FILTER" +``` + ## Option Types ### Text diff --git a/doc/10-Migration.md b/doc/10-Migration.md index a03b608b..d5a3ec8d 100644 --- a/doc/10-Migration.md +++ b/doc/10-Migration.md @@ -95,7 +95,7 @@ The returned list is ordered the same and any unrecognized url is left unchanged ] ``` -**cURL example:** +**curl example:** `curl -s -HContent-Type:application/json -HAccept:application/json -u icingaadmin:icinga http://localhost/icingaweb2/icingadb/migrate/monitoring-url -d '["/icingaweb2/monitoring/list/services?hostgroup_name=prod-hosts|(_host_env=prod&_host_stage!=testing)","/icingaweb2/businessprocess/process/show?config=production"]'`