grafana / grafana

The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
https://grafana.com
GNU Affero General Public License v3.0
64.36k stars 12.05k forks source link

[Bug] alerts-notifications API route seems to be missing, but present in docs #8105

Closed JohnnyMarnell closed 7 years ago

JohnnyMarnell commented 7 years ago

Really excited about Grafana alerts! Trying to use the /api/alerts-notifications listed here

It appears to be referenced in the docs, but the route not actually set up, based on quick grep. But also these endpoints functionality could already be implemented (e.g. alerting.go: func GetAlertNotifications)

$ find . -type f | xargs grep '/api/alerts'
./docs/sources/http_api/alerting.md:`GET /api/alerts/`
./docs/sources/http_api/alerting.md:    GET /api/alerts HTTP/1.1
./docs/sources/http_api/alerting.md:`GET /api/alerts/:id`
./docs/sources/http_api/alerting.md:    GET /api/alerts/1 HTTP/1.1
./docs/sources/http_api/alerting.md:`POST /api/alerts/:id/pause`
./docs/sources/http_api/alerting.md:    POST /api/alerts/1/pause HTTP/1.1
./docs/sources/http_api/alerting.md:`POST /api/alerts-notifications`
./docs/sources/http_api/alerting.md:    POST /api/alerts-notifications HTTP/1.1
./docs/sources/http_api/alerting.md:`PUT /api/alerts-notifications/1`
./docs/sources/http_api/alerting.md:    PUT /api/alerts-notifications/1 HTTP/1.1
./docs/sources/http_api/alerting.md:`DELETE /api/alerts-notifications/:notificationId`
./docs/sources/http_api/alerting.md:    DELETE /api/alerts-notifications/1 HTTP/1.1
./pkg/api/alerting.go:// GET /api/alerts
./pkg/api/alerting.go:// POST /api/alerts/test
./pkg/api/alerting.go:// GET /api/alerts/:id
./pkg/api/alerting.go:// DEL /api/alerts/:id
./pkg/api/alerting.go://POST /api/alerts/:alertId/pause
./public/app/features/alerting/alert_list_ctrl.ts:    this.backendSrv.get('/api/alerts', this.filters).then(result => {
./public/app/features/alerting/alert_list_ctrl.ts:    this.backendSrv.post(`/api/alerts/${alert.id}/pause`, payload).then(result => {
./public/app/features/alerting/alert_tab_ctrl.ts:    return this.backendSrv.post('/api/alerts/test', payload).then(res => {
./public/app/features/annotations/annotations_srv.ts:    this.alertStatesPromise = this.backendSrv.get('/api/alerts/states-for-dashboard', {dashboardId: options.dashboard.id});
./public/app/plugins/panel/alertlist/module.ts:    this.backendSrv.get(`/api/alerts`, params)
torkelo commented 7 years ago

thanks for the heads up! was a mistake in the docs,

Should be

POST /api/alert-notifications