Skip to main content
Glama
check-duplicate-accounts.cjsβ€’3.21 kB
#!/usr/bin/env node /** * Check for duplicate account IDs across customers */ const axios = require('axios'); async function checkDuplicateAccounts() { console.log('πŸ” CHECKING FOR DUPLICATE ACCOUNT IDS\n'); console.log('=====================================\n'); try { // Authenticate const authResponse = await axios.post('https://api.umbrellacost.io/api/v1/users/signin', { username: 'david+allcloud@umbrellacost.com', password: 'B4*zcI7#F7poEC' }); const token = authResponse.data.jwtToken; const userKey = JSON.parse(Buffer.from(token.split('.')[1], 'base64').toString()).sub; // Get divisions const tempApiKey = `${userKey}:15808:0`; const divisionsResponse = await axios.get('https://api.umbrellacost.io/api/v1/users/plain-sub-users', { headers: { 'Authorization': token, 'apikey': tempApiKey } }); const customerDivisions = divisionsResponse.data.customerDivisions; // Build a map of accountId to customers const accountIdMap = {}; for (const [customerName, divisions] of Object.entries(customerDivisions)) { if (Array.isArray(divisions)) { for (const division of divisions) { const accountId = String(division.accountId); if (!accountIdMap[accountId]) { accountIdMap[accountId] = []; } accountIdMap[accountId].push({ customer: customerName, division: division.accountName, accountKey: division.accountKey, divisionId: division.divisionId }); } } } // Find duplicates console.log('DUPLICATE ACCOUNT IDS (appearing in multiple customers):\n'); let foundDuplicates = false; for (const [accountId, locations] of Object.entries(accountIdMap)) { if (locations.length > 1) { foundDuplicates = true; console.log(`Account ID: ${accountId}`); console.log(' Found in:'); locations.forEach(loc => { console.log(` - Customer: "${loc.customer}"`); console.log(` Division: ${loc.division}`); console.log(` Account Key: ${loc.accountKey}`); console.log(` Division ID: ${loc.divisionId}`); }); console.log(''); } } if (!foundDuplicates) { console.log('No duplicate account IDs found.\n'); } // Specifically check for our problem accounts console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'); console.log('SPECIFIC ACCOUNTS:\n'); const checkAccounts = ['696314371547', '533084403826']; for (const accountId of checkAccounts) { if (accountIdMap[accountId]) { console.log(`Account ${accountId}:`); accountIdMap[accountId].forEach(loc => { console.log(` ${loc.customer}: ${loc.division} (key=${loc.accountKey}, div=${loc.divisionId})`); }); console.log(''); } } } catch (error) { console.error('❌ Error:', error.response?.data || error.message); } } checkDuplicateAccounts().catch(console.error);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/daviddraiumbrella/invoice-monitoring'

If you have feedback or need assistance with the MCP directory API, please join our Discord server