Does the Contact-point provisioning API actually work?

Grafana v9.2.5

API is accessible

$ curl -H 'accept: application/json' -H 'authorization: Basic '$PASSWORD -sS http://localhost:3333/api/v1/provisioning/contact-points | jq -r .[0]  | tee email.out
  "uid": "L-EVbnTVk",
  "name": "email receiver",
  "type": "email",
  "settings": {
    "addresses": "<>"
  "disableResolveMessage": false

I should be able to change the address

$ sed -e 's/example/no-reply/' email.out | curl -X PUT -d @- -H 'authorization: Basic '$PASSWORD -sS http://localhost:3333/api/v1/provisioning/contact-points/$(jq -r .uid email.out) | jq -r .
  "message": "bad request data",
  "traceID": ""

Error logging is useless

{"error":"bad content type","level":"error","logger":"context","msg":"bad request data","orgId":1,"remote_addr":"","t":"2023-01-18T17:43:23.383629368Z","traceID":"","uname":"admin","userId":1}
{"duration":"24.928421ms","handler":"/api/v1/provisioning/contact-points/:UID","level":"info","logger":"context","method":"PUT","msg":"Request Completed","orgId":1,"path":"/api/v1/provisioning/contact-points/L-EVbnTVk","referer":"","remote_addr":"","size":43,"status":400,"t":"2023-01-18T17:43:23.383717429Z","time_ms":24,"uname":"admin","userId":1}

The json sent is the a same as received by the api, except a change to email address, so should be well formed. So why am I unable to effect change by API, why no sensible error message.

I’ve tried this with slack and other type nothing works here despite being correct and valid json. Error messages make it impossible to bebug.

Hi! I think you might be missing the Content-Type header in your PUT request. It should be application/json.

1 Like