const axios = require('axios');
async function testDashboards() {
const BASE_URL = 'https://api.dev.umbrellacost.dev/api';
const USERNAME = 'elisha+testmcpdev@anodot.com';
const PASSWORD = 'Test123!';
try {
console.log('🔐 Authenticating...\n');
// Authenticate with Cognito
const authResponse = await axios.post(`${BASE_URL}/v1/users/signin`, {
username: USERNAME,
password: PASSWORD
});
const token = authResponse.data.jwtToken;
console.log('✅ Authentication successful\n');
// Test dashboards endpoint
console.log('📊 Testing /v1/dashboards endpoint...\n');
const dashboardResponse = await axios.get(`${BASE_URL}/v1/dashboards`, {
headers: {
'Authorization': token,
'Content-Type': 'application/json'
},
validateStatus: () => true
});
console.log(`Status: ${dashboardResponse.status}`);
console.log(`Status Text: ${dashboardResponse.statusText}\n`);
if (dashboardResponse.status === 200) {
console.log('✅ SUCCESS - Dashboards endpoint is working!');
console.log('\nResponse data:');
console.log(JSON.stringify(dashboardResponse.data, null, 2));
} else {
console.log('❌ FAILED');
console.log('Error:', dashboardResponse.data);
}
} catch (error) {
console.error('❌ Error:', error.response?.data || error.message);
}
}
testDashboards();