We have recently upgraded Grafana from 8.2.2 to 9.3.2 in our company and started to use the new unified alerting API. I am currently trying to automate dashboard and alert creation using the new API. I have implemented the process to create a new alert rule but our creation script should run daily considering alert rules can change. And when I try to create an alert rule for a second time, the API returns unique constraint error as expected
To fix this, I wanted to check if my alert is already created and if so, I would use PUT with uid instead of using POST.
I am trying to get all the alert rules using
/api/v1/provisioning/alert-rules
and it is returning 404 with this message
{"message":"Not found"}
API works when I provide a uid but as I said, I need to check all alert rules.
Is this endpoint not working? Is there a way to say “create this alert, overwrite if exists” to the API? How can I periodically create/update using the unified alerting API?
Help would be appreciated