I am trying to add a datasource by sending a POST request to /api/datasource
with the following payload:
{
"orgId": 1,
"name": "mydatasource",
"type": "influxdb",
"access": "proxy",
"isDefault": false,
"url": "http://myinfluxdbdomain:8086",
"password": "<password>",
"user": "grafana",
"database": "mydatabase",
"basicAuthUser": true,
"basicAuthUser": "grafana",
"basicAuthPassword": "<password>"
}
The data source is properly added, but the basicAuth
related fields are simply ignored:
{"datasource": {"id": 10,
"orgId": 1,
"name": "mydatasource",
"type": "influxdb",
"typeLogoUrl": "",
"access": "proxy",
"url": "http://myinfluxdbdomain:8086",
"password": "<password>",
"user": "grafana",
"database": "mydatabase",
"basicAuth": false,
"basicAuthUser": "",
"basicAuthPassword": "",
"withCredentials": false,
"isDefault": false,
"secureJsonFields": {},
"version": 1,
"readOnly": false},
"id": 10,
"message": "Datasource added",
"name": "mydatasource"}'
I have tried all sorts of things and still can’t get this to work, which leads me think it is a bug of sort. Has anyone managed to add a datasource which requires basicAuth through the API?