write basic script that fetches tasks as JSON

This commit is contained in:
Aadil Ayub 2023-09-19 16:38:41 +05:00
commit de6fd09921

26
index.js Normal file
View File

@ -0,0 +1,26 @@
const username = 'aadil';
const password = '9dc04fffe0c1c915be487f26a7f8d90f52d47b9861036e6093e8d932c162';
const authHeader = 'Basic ' + btoa(username + ':' + password);
fetch('https://kanboard.autonomic.zone/jsonrpc.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': authHeader
},
body: JSON.stringify({
jsonrpc: '2.0',
method: 'getMyDashboard',
id: 1
}),
})
.then((response) => response.json())
.then((data) => {
// Handle the response data
console.log(data);
})
.catch((error) => {
// Handle any errors
console.error(error);
});