REST API returns 500 when "IPMI credentials" is set to "No explicit credentials" and showing all hosts

CMK version: Checkmk Raw Edition 2.1.0p30
OS version: Ubuntu 18.04.6 LTS

Error message:

  "status": 500,
  "ext": {
    "errors": {
      "management_ipmi_credentials": [
        "Field may not be null."
      ]
    }

We are just moving from the web API to the rest API and I am exploring the possibilites we have.
Turns out that the API returns a 500 http code with the mentioned error, when you set the IPMI credentials to No explicit credentials on any host and try to list all hosts. I’ve used this python code (it’s the example from the API doc)

#!/usr/bin/env python3
import pprint
import requests

HOST_NAME = "localhost"
SITE_NAME = "live"
API_URL = f"http://{HOST_NAME}/{SITE_NAME}/check_mk/api/1.0"

USERNAME = "automation"
PASSWORD = "test123"

session = requests.session()
session.headers['Authorization'] = f"Bearer {USERNAME} {PASSWORD}"
session.headers['Accept'] = 'application/json'

resp = session.get(
    f"{API_URL}/domain-types/host_config/collections/all",
    params={  # goes into query string
        "effective_attributes": False,  # Show all effective attributes on hosts, not just the attributes which were set on this host specifically.
    },
)
if resp.status_code == 200:
    pprint.pprint(resp.json())
elif resp.status_code == 204:
    print("Done")
else:
    raise RuntimeError(pprint.pformat(resp.json()))

The easy fix for us was to just uncheck the checkbox in the web configuration, as we have one pair of IPMI credentials on all hosts and have that configured in the main folder.

But I would guess that this is a bug.

Hello,

I have the same issue when trying to update the monitoring phase of any service of the host from ‘monitored’ to ‘ignored’ if the host is inside a folder otherwise it works.

So my current workaround is taking the hosts temporarily out of the folder, changing the phase, putting it back to the folder it belongs too.

Maybe this can help but yeah same issue.