Replies: 1 comment
-
This is not related to the plugin. Pleas ask questions in the community forum. https://community.grafana.com/ |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Grafana v10.2.0 (895fbafb7a)
grafana-json-datasource v1.3.8
I'm trying to fully automate installation of datasources which fails when POSTing to /api/datasources method.
The steps I use:
Install the grafana-json-datasource: grafana-cli plugins install marcusolsson-json-datasource
curl -X POST -H "Authorization: Basic $AUTH" -H "Content-Type: application/json" --data "$datasource" https://HOSTNAME/grafana/api/datasources
This is the the content of $datasource above:
[
{
"uid": "d939889a-e25c-4422-b907-2c801ff3c5d2",
"orgId": 1,
"name": "GenerateToken",
"type": "marcusolsson-json-datasource",
"typeName": "JSON API",
"typeLogoUrl": "/grafana/public/plugins/marcusolsson-json-datasource/img/logo.svg",
"access": "proxy",
"url": "http://localhost:3001/generateToken",
"user": "",
"database": "",
"basicAuth": false,
"isDefault": false,
"jsonData": {},
"readOnly": false
}
]
The result is:
{"message":"bad request data","traceID":""}{"message":"bad request data","traceID":""}
(Which is obviously also failing in creating the datasource)
If I try this content:
[ {
"uid": "ae984540-8c1c-4e16-8863-f4700ffbe689",
"orgId": 1,
"name": "toplist",
"type": "elasticsearch",
"typeName": "Elasticsearch",
"typeLogoUrl": "/grafana/public/app/plugins/datasource/elasticsearch/img/elasticsearch.svg",
"access": "proxy",
"url": "http://db2:9200",
"user": "",
"database": "toplist",
"basicAuth": false,
"isDefault": false,
"jsonData": {
"includeFrozen": false,
"logLevelField": "",
"logMessageField": "",
"maxConcurrentShardRequests": 5,
"timeField": "first_timestamp"
},
"readOnly": false
}
]
I get:
{
"datasource": {
"id": 7,
"uid": "ae984540-8c1c-4e16-8863-f4700ffbe689",
"orgId": 1,
"name": "toplist",
"type": "elasticsearch",
"typeLogoUrl": "/grafana/public/app/plugins/datasource/elasticsearch/img/elasticsearch.svg",
"access": "proxy",
"url": "http://db2:9200",
"user": "",
"database": "toplist",
"basicAuth": false,
"basicAuthUser": "",
"withCredentials": false,
"isDefault": false,
"jsonData": {
"includeFrozen": false,
"logLevelField": "",
"logMessageField": "",
"maxConcurrentShardRequests": 5,
"timeField": "first_timestamp"
},
"secureJsonFields": {},
"version": 1,
"readOnly": false
},
"id": 7,
"message": "Datasource added",
"name": "toplist"
}
(Which also creates a datasource)
Beta Was this translation helpful? Give feedback.
All reactions