Skip to main content
Glama
test-anomalies-direct.cjs2.23 kB
const axios = require('axios'); async function testAnomaliesDirect() { 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; console.log('✅ Authenticated\n'); console.log('📊 Testing anomaly-detection endpoint...\n'); const response = await axios.get(`${BASE_URL}/v1/anomaly-detection`, { params: { startDate: '2025-09-01', endDate: '2025-10-07', isPpApplied: false }, headers: { 'Authorization': token, 'apikey': `${userKey}:${ACCOUNT_KEY}:${DIVISION_ID}`, 'Content-Type': 'application/json', 'commonParams': JSON.stringify({isPpApplied: false}) } }); console.log('✅ Response received\n'); console.log('=== ANOMALY DETECTION RESPONSE ==='); console.log(`Status: ${response.status}`); console.log(`Data type: ${typeof response.data}`); console.log(`Data is array: ${Array.isArray(response.data)}`); if (Array.isArray(response.data)) { console.log(`Number of anomalies: ${response.data.length}`); if (response.data.length > 0) { console.log('\nFirst anomaly:'); console.log(JSON.stringify(response.data[0], null, 2)); } } else if (response.data && typeof response.data === 'object') { console.log('\nResponse structure:'); console.log(JSON.stringify(response.data, null, 2)); } else { console.log('\nRaw response:'); console.log(response.data); } } catch (error) { console.error('❌ Error:', error.response?.data || error.message); if (error.response) { console.error('Status:', error.response.status); console.error('Headers:', error.response.headers); } } } testAnomaliesDirect();

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