Skip to main content
Glama
test-plain-sub-users-issue.cjs3.93 kB
#!/usr/bin/env node /** * Test script to reproduce the plain-sub-users API issue with isPpApplied */ const axios = require('axios'); async function testPlainSubUsersIssue() { console.log('🔍 Testing plain-sub-users API issue with isPpApplied...\n'); const baseURL = 'https://api.umbrellacost.io/api/v1'; // Test credentials const testCredentials = { email: 'david+allcloud@umbrellacost.com', password: 'UmbrellaCost2024!' }; try { // Step 1: Authenticate to get tokens console.log('1️⃣ Authenticating...'); const authResponse = await axios.post(`${baseURL}/auth/login`, testCredentials); if (!authResponse.data.Authorization) { throw new Error('Authentication failed - no Authorization token'); } const authToken = authResponse.data.Authorization; const apiKey = authResponse.data.apikey; console.log(`✅ Authentication successful`); console.log(` Authorization: ${authToken.substring(0, 50)}...`); console.log(` API Key: ${apiKey}\n`); // Step 2: Test plain-sub-users WITHOUT commonparams header console.log('2️⃣ Testing /users/plain-sub-users WITHOUT commonparams header...'); try { const response1 = await axios.get(`${baseURL}/users/plain-sub-users`, { headers: { 'Authorization': authToken, 'apikey': apiKey, 'Content-Type': 'application/json' } }); console.log(`✅ Request succeeded (status: ${response1.status})`); console.log(` Response data:`, JSON.stringify(response1.data, null, 2)); } catch (error) { console.log(`❌ Request failed: ${error.response?.status} ${error.response?.statusText}`); console.log(` Error data:`, JSON.stringify(error.response?.data, null, 2)); } console.log('\n' + '='.repeat(80) + '\n'); // Step 3: Test plain-sub-users WITH commonparams header (isPpApplied: true) console.log('3️⃣ Testing /users/plain-sub-users WITH commonparams header (isPpApplied: true)...'); try { const response2 = await axios.get(`${baseURL}/users/plain-sub-users`, { headers: { 'Authorization': authToken, 'apikey': apiKey, 'Content-Type': 'application/json', 'commonparams': JSON.stringify({ isPpApplied: true }) } }); console.log(`✅ Request succeeded (status: ${response2.status})`); console.log(` Response data:`, JSON.stringify(response2.data, null, 2)); } catch (error) { console.log(`❌ Request failed: ${error.response?.status} ${error.response?.statusText}`); console.log(` Error data:`, JSON.stringify(error.response?.data, null, 2)); } console.log('\n' + '='.repeat(80) + '\n'); // Step 4: Test plain-sub-users WITH commonparams header (isPpApplied: false) console.log('4️⃣ Testing /users/plain-sub-users WITH commonparams header (isPpApplied: false)...'); try { const response3 = await axios.get(`${baseURL}/users/plain-sub-users`, { headers: { 'Authorization': authToken, 'apikey': apiKey, 'Content-Type': 'application/json', 'commonparams': JSON.stringify({ isPpApplied: false }) } }); console.log(`✅ Request succeeded (status: ${response3.status})`); console.log(` Response data:`, JSON.stringify(response3.data, null, 2)); } catch (error) { console.log(`❌ Request failed: ${error.response?.status} ${error.response?.statusText}`); console.log(` Error data:`, JSON.stringify(error.response?.data, null, 2)); } } catch (error) { console.error('💥 Test failed:', error.message); if (error.response) { console.error(' Status:', error.response.status); console.error(' Data:', error.response.data); } } } // Run the test testPlainSubUsersIssue().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