mirror of
https://github.com/geoffsee/open-gsio.git
synced 2025-09-08 22:56:46 +00:00
init
This commit is contained in:
31
scripts/check-analytics.js
Normal file
31
scripts/check-analytics.js
Normal file
@@ -0,0 +1,31 @@
|
||||
const TOKEN = "";
|
||||
const ACCOUNT_ID = "";
|
||||
|
||||
async function showTables() {
|
||||
const url = `https://api.cloudflare.com/client/v4/accounts/${ACCOUNT_ID}/analytics_engine/sql`;
|
||||
|
||||
const options = {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${TOKEN}`,
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
body: "SHOW TABLES",
|
||||
};
|
||||
|
||||
try {
|
||||
console.log("Sending request to Cloudflare Analytics Engine...");
|
||||
const response = await fetch(url, options);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
console.log("Response received:", JSON.stringify(data, null, 2));
|
||||
} catch (error) {
|
||||
console.error("Error occurred:", error.message);
|
||||
}
|
||||
}
|
||||
|
||||
showTables();
|
Reference in New Issue
Block a user