Time Periods, unable to set 24:00 via RestApi

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:0024: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?

1 Like

This appears to appears to be a duplicate of BUG: Creating timeperiods with the REST-API fails for midnight
Added some comments there hoping for a resolution.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.