Werk #15966: downtimes: add site property to the downtimes endpoints

Komponente REST API
Titel downtimes: add site property to the downtimes endpoints
Datum 31.07.2023
Checkmk Edition Checkmk Raw (CRE)
Checkmk-Version 2.2.0p8 2.3.0b1
Level Kleine Änderung
Klasse Bugfix
Kompatibilität Inkompatibel - Manuelle Interaktion könnte erforderlich sein

This werk introduces several changes to the downtimes endpoints.

  1. Downtime IDs are integers beginning from 1, both for the main site & for remote sites. This means that the same downtime ID can exist on more than one site at the same time. This caused problems when calling the DELETE endpoint as we weren't sure which ID the client wanted to delete. To get around this problem, we have introduced a mandatory "site_id" field which the client has to specify when they want to delete a downtime.

E.g.

curl \
    --request POST \
    --write-out "\nxxx-status_code=%{http_code}\n" \
    --header "Authorization: Bearer $USERNAME $PASSWORD" \
    --header "Accept: application/json" \
    --header "Content-Type: application/json" \
    --data '{
          "delete_type": "params",
          "downtime_id": "1",
          "site_id": "heute"
        }' \
    "$API_URL/domain-types/downtime/actions/delete/invoke"
  1. Like point 2, calling GET downtime with only a downtime ID could also cause the same problem. Therefore we have also introduced the mandatory "site_id" query parameter field here too.

E.g.

curl \
    -G \
    --request GET \
    --write-out "\nxxx-status_code=%{http_code}\n" \
    --header "Authorization: Bearer $USERNAME $PASSWORD" \
    --header "Accept: application/json" \
    --data-urlencode 'site_id=heute' \
    "$API_URL/objects/downtime/1"
  1. Now that the site_id field is mandatory in both the DELETE and GET downtime endpoints, we now return the site_id field as a downtime attribute in both the show downtime and show downtimes endpoints.

  2. This last change introduces a new optional query parameter on the show all downtimes endpoint. The client can now specify the site_id as a filter, so that they can list all downtimes for a specific site.

  3. We've added a response schema which adds to minor changes. a. The domainType for collection responses now correctly shows "downtime" instead of "dict" b. The API documentation now shows the expected response.

Zur Liste aller Werks