Hi,
I’m trying to make a POST
on the Grafana API but I always got this error:
{ [Error: failed [500] {"message":"Failed to star dashboard"}]
response:
{ statusCode: 500,
content: '{"message":"Failed to star dashboard"}',
headers:
{ 'content-type': 'application/json',
date: 'Mon, 27 Mar 2017 12:52:23 GMT',
'content-length': '38',
connection: 'close' },
data: { message: 'Failed to star dashboard' } } }
And in the Grafana logs I have:
lvl=eror msg="Failed to star dashboard" logger=context userId=0 orgId=1 uname= error="Command missing required fields"
That’s my call (idDash is set I have tested it):
HTTP.call("POST", GRAFANA_URL_API + 'user/stars/dashboard/' + idDash, {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': APIKEY_ADMIN,
},
},
function(error, result) {
if (!error) {
console.log(result);
idDash3 = idDash
resolve(idDash3);
} else {
console.error("fail star dashboard");
console.error(error);
//throw error;
}
});
I even tried with empty data :
HTTP.call("POST", GRAFANA_URL_API + 'user/stars/dashboard/' + idDash, {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': APIKEY_ADMIN,
},
data: {
}
},
function(error, result) {
if (!error) {
console.log(result);
idDash3 = idDash
resolve(idDash3);
} else {
console.error("fail star dashboard");
console.error(error);
//throw error;
}
});
What is missing ? Why it doesn’t work ?