Mysql Datasource

Hi,
I am trying to create mysql datasource using the api.

curl -X POST --insecure -H “Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk==” -H “Content-Type: application/json” -d '{

“name”: “test”,
“type”: “mysql”,
“host”: “localhost:3306”,
“password”: “password”,
“user”: “root”,
“database”: “test”,

}’ http://grafana.staged-by-discourse.com/api/datasources

But its throwing this “[{“fieldNames”:[“Access”],“classification”:“RequiredError”,“message”:“Required”}]” error.

In GUI when adding mysql datasource it won’t ask any access or classification.

If anybody created a mysql datasource, Please let me know the steps.

Thanks in advance…

just add a property “access”: “proxy”

thank you,

it worked perfectly,

i added “access”: “direct”

Hello,
I face the same error while trying to add a datasource via api.
here is my data,
{
“datasource”: {
“id”: 80,
“orgId”: 20,
“name”: “test_datasource_from_api”,
“type”: “mysql”,
“access”: “proxy”,
“url”: “xyz”,
“password”: “”,
“user”: “admin”,
“database”: “test”,
“basicAuth”: false,
“basicAuthUser”: “”,
“basicAuthPassword”: “”,
“withCredentials”: false,
“isDefault”: false,
“readOnly”: false
},
“id”: 80,
“message”: “Datasource added”,
“name”: “test_datasource_from_api”
}

I have added the access as proxy but still im facing issue.

Error mesage: [{“fieldNames”:[“Type”],“classification”:“RequiredError”,“message”:“Required”},{“fieldNames”:[“Access”],“classification”:“RequiredError”,“message”:“Required”}]

Is this a case-sensitivity problem?

“type” is not the same as “Type”, and “access” is not the same as “Access”.

Antony.

Hi Antony,
The “Type” and “Access” are from my error, my actual data have lowercase values. Not sure what the error states.