Using kuma-client to create a status page
I'm trying to create a script that will create a status page for me on start-up if it doesn't already exist, but I'm having trouble with the kuma-client. I tried taking the output of status-page get my-slug and using it as the input to status-page add <file>, but ran into this error:
{"error":"Server responded with an error: Cannot set properties of null (setting 'status_page_id')"}
However, when I check UptimeKuma, the status page was created, but with no monitored services. I'm not sure what the format of the input file should be, or whether I need to use a different structure?
This is my status page JSON file:
{
"status_page_id": 99, # Also tried "id", and even removing this key completely
"slug": "test",
"title": "Test",
"icon": "/icon.svg",
"theme": "dark",
"published": true,
"showTags": false,
"domainNameList": [],
"customCSS": "body {\n \n}\n",
"showPoweredBy": true,
"showCertificateExpiry": false,
"publicGroupList": [
{
"id": 1,
"name": "Services",
"weight": 1,
"monitorList": [
{
"id": 1,
"name": "My Site",
"type": "http"
}
]
}
]
}
Hi, sorry for the long delay, the problem is your pass an id value for your entry in the publicGroupList, but if you create a new status-page that group (and therefore it's id) doesn't exists. And yes when you add a group you should not supply a status_page_id, though I think uptime-kuma will ignore this and assign a new id anyway.
Hey, thanks for the reply. I actually tried it with no id value too, but it didn't work. I can't remember if it had the same error, but I think it did. I can retry and confirm if needed, but it definitely didn't succeed.
Just to make sure, I'm talking about this id specifically:
{
"status_page_id": 99, # Also tried "id", and even removing this key completely
"slug": "test",
"title": "Test",
"icon": "/icon.svg",
"theme": "dark",
"published": true,
"showTags": false,
"domainNameList": [],
"customCSS": "body {\n \n}\n",
"showPoweredBy": true,
"showCertificateExpiry": false,
"publicGroupList": [
{
- "id": 1,
"name": "Services",
"weight": 1,
"monitorList": [
{
"id": 1,
"name": "My Site",
"type": "http"
}
]
}
]
}
Additionally the status_page_id should also be removed, but I don't think it breaks anything, the monitor's id is actually required and needs to stay.