Traceback (most recent call last):
File "./cmk_rest_api.py", line 90, in <module>
raise RuntimeError(pprint.pformat(send.json()))
RuntimeError: {'detail': "Value ['cert', {'cert_days': [29, 14]}] is not allowed here.",
'status': 400,
'title': "Problem in (sub-)field 'mode_sel'"}
When I try to make an HTTP service rule with the REST API, this error occurs in the “value_raw” section. The string I use in this section is copy-pasted from another rule I read from the API, so it shouldn’t be wrong. I think it’s a bug in the API.
Thanks @paulr282 for taking the time to post after resolving your own issue. I just ran into the same thing today and your post allowed me to solve the problem quickly.
Personally I think this should be considered a bug in the API. In my opinion, the input and output formats should be the same. With that said, maybe there are reasons that they need to be different in this specific case.
Note also that the Export this rule for API link in the web UI does provide the correct format that uses round brackets.
This is a big issue if you want to automate via Ansible - Ansible also changes the brackets from “()” to “[]” and converts it to valid JSON which is not usable on the API. This is an API bug and should be fixed in my opinion - It would be feasible to use standard JSON. This issue is also present with the GitHub - tribe29/ansible-checkmk: Ansible integration of CheckMK collection - It is almost impossible to use variables in the YAML due to this problem.
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.