Skip to main content
Glama
test-saola-only.cjsβ€’3.98 kB
#!/usr/bin/env node const https = require('https'); const axios = require('axios'); const axiosInstance = axios.create({ httpsAgent: new https.Agent({ rejectUnauthorized: false }), timeout: 30000 // 30 second timeout }); async function testSaola() { console.log('\n════════════════════════════════════════'); console.log(' 🌟 SAOLA TEST RESULTS'); console.log('════════════════════════════════════════'); const baseUrl = 'https://api.umbrellacost.io/api/v1'; try { console.log('\nπŸ“Œ Authenticating as david+saola@umbrellacost.com...'); const authResponse = await axiosInstance.post(`${baseUrl}/users/signin`, { username: 'david+saola@umbrellacost.com', password: 'Dsamsung1!' }); const token = authResponse.data.jwtToken; const tokenPayload = JSON.parse(Buffer.from(token.split('.')[1], 'base64').toString()); const userKey = tokenPayload.username || tokenPayload.sub; console.log('βœ… Authenticated. User Key:', userKey); // Get SAOLA account const userResponse = await axiosInstance.get(`${baseUrl}/users`, { headers: { 'Authorization': token } }); const saolaAccount = userResponse.data.accounts?.find(acc => acc.accountKey === '9350' || acc.accountKey === 9350 ); const apiKey = `${userKey}:${saolaAccount?.accountKey || '9350'}:0`; console.log('\nπŸ“Š Querying SAOLA costs March-July 2025...'); const params = new URLSearchParams({ startDate: '2025-03-01', endDate: '2025-07-31', periodGranLevel: 'month', groupBy: 'usagedate', 'costType': 'cost' }); const response = await axiosInstance.get(`${baseUrl}/invoices/caui?${params}`, { headers: { 'Authorization': token, 'apikey': apiKey } }); if (response.data && response.data.length > 0) { console.log('\nβœ… SAOLA Monthly Costs:'); console.log('────────────────────────────────────'); response.data.forEach(item => { const month = item.usage_date; const monthName = { '2025-03': 'March', '2025-04': 'April', '2025-05': 'May', '2025-06': 'June', '2025-07': 'July' }[month]; if (monthName) { console.log(`${monthName} 2025: $${item.total_cost.toFixed(2)}`); } }); console.log('────────────────────────────────────'); console.log(`Account ID: ${response.data[0].account_id}`); // Expected values const expected = { '2025-03': 104755.07, '2025-04': 111340.42, '2025-05': 149774.24, '2025-06': 165666.57, '2025-07': 183920.58 }; let allMatch = true; for (const item of response.data) { if (expected[item.usage_date]) { const diff = Math.abs(item.total_cost - expected[item.usage_date]); if (diff > 1) allMatch = false; } } console.log(`\n${allMatch ? 'βœ… SAOLA TEST PASSED!' : '❌ Some values differ from expected'}`); } } catch (error) { console.error('❌ Error:', error.message); } } testSaola();

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