Skip to main content
Glama
test-saola-costs-actual-dates.cjs2.3 kB
const axios = require('axios'); async function testSaolaCosts() { console.log('🧪 Testing SAOLA account costs with various date ranges...\n'); // Login first const loginResponse = await axios.post('https://cognito-idp.us-east-1.amazonaws.com/', { AuthFlow: 'USER_PASSWORD_AUTH', ClientId: '7i82cnpt469rcd93fif1glhnkm', AuthParameters: { USERNAME: 'david+saola@umbrellacost.com', PASSWORD: process.env.UMBRELLA_PASSWORD || 'YourPasswordHere' } }, { headers: { 'X-Amz-Target': 'AWSCognitoIdentityProviderService.InitiateAuth', 'Content-Type': 'application/x-amz-json-1.1' } }); const idToken = loginResponse.data.AuthenticationResult.IdToken; const userKey = '8bd39ae4-ebea-4426-bd22-07349dd8b962'; // SAOLA userKey const testRanges = [ { name: '2024 Full Year', start: '2024-01-01', end: '2024-12-31' }, { name: '2024 Sep-Oct', start: '2024-09-01', end: '2024-10-31' }, { name: '2025 Apr-Sep', start: '2025-04-01', end: '2025-09-29' }, { name: 'Last 30 days', start: '2024-09-02', end: '2024-10-02' } ]; for (const range of testRanges) { try { console.log(`\n📅 Testing: ${range.name} (${range.start} to ${range.end})`); const response = await axios.get('https://api.umbrellacost.io/api/v1/invoices/caui', { params: { startDate: range.start, endDate: range.end, groupBy: 'none', periodGranLevel: 'month', costType: 'cost', isUnblended: true, excludeFilters: { chargetype: ['Tax'] } }, headers: { 'Authorization': idToken, 'apikey': `${userKey}:9350:0`, 'commonparams': JSON.stringify({ isPpApplied: true }) } }); const dataLength = response.data?.length || 0; const totalCost = response.data?.reduce((sum, item) => sum + (parseFloat(item.cost) || 0), 0) || 0; console.log(` ✅ Response: ${dataLength} items, Total cost: $${totalCost.toFixed(2)}`); if (dataLength > 0) { console.log(` 📊 Sample data:`, response.data[0]); } } catch (error) { console.log(` ❌ Error: ${error.response?.status} ${error.response?.statusText || error.message}`); } } } testSaolaCosts().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