Neuling braucht Hilfe.API einbinden
Hallo
Bin da etwas im dunkeln.
Kann mir einer sagen was ich da eingeben muss damit API funktioniert ?
function sendApiUpdate(period, value) {
const apiUrl = 'https://api.ninox.com/v1/teams/[Your Team]/databases/[YOUR_DATABASE]/tables/[YOUR_TABLE]/records';
const token =
const requestBody = {
period: period,
value: value
};
fetch(apiUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`,
},
body: JSON.stringify(requestBody),
})
.then(response => response.json())
.then(data => {
if (data.success) {
console.log('Update successful', data);
location.reload();
} else {
console.error('Update failed', data);
alert('Update failed: ' + data.message);
}
})
.catch(error => {
console.error('Error:', error);
alert('Error communicating with the API.');
});
}
</script>
Danke
4 Antworten
-
Hi,
If you're looking for examples of how to use the Fetch API to communicate with the Ninox backend, you can download the latest version of the Dashboard Template (v.11.4) from the following thread:
-
stuff like this
Content aside
- vor 7 TagenZuletzt aktiv
- 4Antworten
- 49Ansichten
-
2
Folge bereits