Skip to main content
Glama
test-anomaly-response-structure.cjs2.48 kB
const axios = require('axios'); async function testAnomalyResponse() { 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 { // Authenticate 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('Making anomaly API call...\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 STRUCTURE ANALYSIS ===\n'); console.log(`response.data type: ${typeof response.data}`); console.log(`response.data is object: ${typeof response.data === 'object'}`); console.log(`response.data has anomalies: ${response.data.hasOwnProperty('anomalies')}`); if (response.data.anomalies) { console.log(`response.data.anomalies is array: ${Array.isArray(response.data.anomalies)}`); console.log(`response.data.anomalies.length: ${response.data.anomalies.length}`); } console.log('\n=== CONDITION CHECK ==='); const path = '/v1/anomaly-detection'; const condition = path === '/v1/anomaly-detection' && typeof response.data === 'object' && response.data.anomalies; console.log(`Condition result: ${condition}`); console.log(` path === '/v1/anomaly-detection': ${path === '/v1/anomaly-detection'}`); console.log(` typeof response.data === 'object': ${typeof response.data === 'object'}`); console.log(` response.data.anomalies (truthy): ${!!response.data.anomalies}`); console.log('\n=== TOP-LEVEL KEYS ==='); console.log(Object.keys(response.data)); } catch (error) { console.error('❌ Error:', error.message); if (error.response) { console.error('Status:', error.response.status); console.error('Data:', error.response.data); } } } testAnomalyResponse();

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