Skip to main content
Glama
test-unblended-exclude-tax.cjs3.04 kB
const axios = require('axios'); async function testUnblendedExcludeTax() { const BASE_URL = 'https://api.dev.umbrellacost.dev/api'; const USERNAME = 'elisha+testmcpdev@anodot.com'; const PASSWORD = 'Test123!'; const ACCOUNT_KEY = '111111639'; const DIVISION_ID = '0'; try { console.log('🔐 Authenticating...\n'); const authResponse = await axios.post(`${BASE_URL}/v1/users/signin`, { username: USERNAME, password: PASSWORD }); const token = authResponse.data.jwtToken; const tokenPayload = JSON.parse(Buffer.from(token.split('.')[1], 'base64').toString()); const userKey = tokenPayload.sub; const apiKey = `${userKey}:${ACCOUNT_KEY}:${DIVISION_ID}`; console.log('✅ Authenticated\n'); console.log('═'.repeat(80)); console.log('TEST 1: Unblended WITHOUT excluding tax'); console.log('═'.repeat(80)); const params1 = { startDate: '2025-01-01', endDate: '2025-10-07', isUnblended: true, costType: ['cost', 'discount'], periodGranLevel: 'month', groupBy: 'none' }; console.log('Params:', JSON.stringify(params1, null, 2)); const response1 = await axios.get(`${BASE_URL}/v2/invoices/cost-and-usage`, { params: params1, headers: { 'Authorization': token, 'apikey': apiKey } }); if (response1.data.data && response1.data.data.length > 0) { console.log(`Jan 2025: $${response1.data.data[0].total_cost.toFixed(2)}\n`); } console.log('═'.repeat(80)); console.log('TEST 2: Unblended WITH excluding tax (matching your URL)'); console.log('═'.repeat(80)); const params2 = { startDate: '2025-01-01', endDate: '2025-10-07', isUnblended: true, costType: ['cost', 'discount'], periodGranLevel: 'month', groupBy: 'none', excludeFilters: { chargetype: ['Tax'] } }; console.log('Params:', JSON.stringify(params2, null, 2)); const response2 = await axios.get(`${BASE_URL}/v2/invoices/cost-and-usage`, { params: params2, headers: { 'Authorization': token, 'apikey': apiKey } }); if (response2.data.data && response2.data.data.length > 0) { console.log(`Jan 2025: $${response2.data.data[0].total_cost.toFixed(2)}\n`); } console.log('═'.repeat(80)); console.log('COMPARISON'); console.log('═'.repeat(80)); console.log(`Without excluding tax: $${response1.data.data[0].total_cost.toFixed(2)}`); console.log(`With excluding tax: $${response2.data.data[0].total_cost.toFixed(2)}`); if (Math.abs(response2.data.data[0].total_cost - 120021.98) < 1) { console.log('\n⚠️ Found it! Excluding tax gives the 120K value'); } } catch (error) { console.error('❌ Error:', error.message); if (error.response) { console.error('Status:', error.response.status); console.error('Data:', JSON.stringify(error.response.data, null, 2)); } } } testUnblendedExcludeTax();

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