Hello
Trying to make api post request to beeceptor online mock api but the request is not sending. Sending the api request through Curl command tool or vscode works with no issue.
I am putting the code here, so that as soon as the panel values(Voltage) changes it is supposed to execute the code?
async function sendMessage() {
const apiUrl = 'https://mockserver.free.beeceptor.com/my/api/path';
try {
const response = await fetch(apiUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json' // beeceptor
},
body: JSON.stringify({ "data": "Hello from grafana" }) // beeceptor
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const responseData = await response.text();
console.log('Response:', responseData);
} catch (error) {
console.error('Error sending message:', error);
}
}
sendMessage();
I tried from VSCode and the code works, mock api receives the post request.
Is grafana blocking anything?