Hi, we are using Checkmk Raw Edition 2.1.0p16
Running into an issue with the RestApi and setting time periods.
According to the documentation on TimePeriods Docs
To include a complete day up until midnight, enter 00:00
— 24:00
, even though the time 24:00 doesn’t actually exist.
However when setting via rest api
import requests
import json
reqUrl = f"http://{baseurl}/{site}/check_mk/api/1.0/objects/time_period/{timeperiod}"
headersList = {
"Accept": "application/json",
"Authorization": f"Bearer {user} {secret}",
"Content-Type": "application/json"
}
payload = json.dumps({"active_time_ranges": [{"day": "sunday", "time_ranges": [{"start": "21:59", "end": "24:00"}]}] }
response = requests.request("PUT", reqUrl, data=payload, headers=headersList)
print(response.text)
The server returns an issue “ValueError: hour must be in 0…23”
extract Stack Trace
" File \"/omd/sites/gw_dev/lib/python3/marshmallow/utils.py\", line 177, in from_iso_time",
" return dt.time(**kw)",
"ValueError: hour must be in 0..23",
Since DateTime does not consider 24:00 as a valid time, is there any workaround or fix for this?