Html, Delete dashb

I want to delete my grafana board using the api in a simple web page that I have created, I have tried everything but it does not work, help me.

<!DOCTYPE html>
<html>
<head>
  <title>Delete Grafana Dashboard</title>
</head>
<body>
  <h1>Delete Grafana Dashboard</h1>
  <button onclick="deleteDashboard()">Delete Dashboard</button>

  <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
  <script>
    // Grafana API Configuration
    const apiKey = 'your-api-token-here'; // Replace this with your API token
    const grafanaBaseUrl = 'https://your-instance.grafana.net/api/'; // Replace this with your Grafana instance URL
    const dashboardUid = 'your-uid-here'; // Replace this with the uid of the dashboard you want to delete

    // Function to delete the dashboard
    async function deleteDashboard() {
      try {
        // Delete the dashboard
        await axios.delete(grafanaBaseUrl + 'dashboards/uid/' + dashboardUid, {
          headers: { 
            'Authorization': `Bearer ${apiKey}`,
            'Accept': 'application/json',
            'Content-Type': 'application/json'
          }
        });

        alert('Dashboard deleted successfully.');
      } catch (error) {
        console.error('Error deleting the dashboard:', error);
        alert('Error deleting the dashboard. Check the console for more details.');
      }
    }
  </script>
</body>
</html>

Can you expound what “does not work” mean?

I can’t clear the board, is my html ok?

I can’t clear the board, is my html ok?

Is there an error in the console log, you probably got some errors there? your html looks fine to me but calling an api from html is kind of :scream: