mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
Add notice about HTTP method POST to the HTTP API documentation (#1274)
The HTTP API documentation omits the fact, that the HTTP method `POST` is required for all endpoints which change things. This PR aims to mention that explicitely to ease API adaption.
This commit is contained in:
parent
fa23e86ae7
commit
b5eed40255
2 changed files with 12 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"]'`
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue