alertmanager
alertmanager copied to clipboard
Silence creator and comment is required in the UI but not in the API
When creating a silence in the UI and leaving the creator and comment empty, you're met with:
However, if you try to execute a silence creation through the API (as long as you have the keys set the value would be empty).
## Create Silence
curl -X "POST" "http://localhost:9093/api/v2/silences" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"matchers": [
{
"value": "test",
"isRegex": false,
"isEqual": true,
"name": "test"
}
],
"comment": "",
"endsAt": "2022-07-11T15:37:27.659Z",
"startsAt": "2022-07-11T13:37:27.659Z",
"createdBy": ""
}'
This succeeds - and you get:
{
"id":"73373e3f-a928-450a-ba75-e9254297b483",
"status":{
"state":"active"
},
"updatedAt":"2022-07-11T13:42:13.444Z",
"comment":"",
"createdBy":"",
"endsAt":"2022-07-11T15:37:27.659Z",
"matchers":[
{
"isEqual":true,
"isRegex":false,
"name":"test",
"value":"test"
}
],
"startsAt":"2022-07-11T13:42:13.444Z"
}
This doesn't seem right and it's kind of inconsistent with what the UI allows - should we validate at an API level that ""
are not allowed?