Qubit_EPM/test_api.js

65 lines
1.9 KiB
JavaScript

// Test script to verify both API calls
async function testKeyTypesAPI() {
console.log('🔍 Testing Key Types API...');
try {
const response = await fetch('https://sandbox.kezel.io/api/qbt_table_key_type_list_get', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
token: "abdhsg",
org: "sN05Pjv11qvH"
})
});
const data = await response.json();
if (data.status === 200 && data.items) {
console.log('✅ Key Types API call successful');
console.log('Key types found:', data.items.length);
data.items.forEach(item => {
console.log(`- ${item.name} (ID: ${item.kytp})`);
});
} else {
console.log('❌ Key Types API call failed:', data.message);
}
} catch (error) {
console.error('❌ Error calling Key Types API:', error);
}
}
async function testColumnTypesAPI() {
console.log('\n🔍 Testing Column Types API...');
try {
const response = await fetch('https://sandbox.kezel.io/api/qbt_column_type_list_get', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
token: "abdhsg",
org: "sN05Pjv11qvH"
})
});
const data = await response.json();
if (data.status === 200 && data.items) {
console.log('✅ Column Types API call successful');
console.log('Column types found:', data.items.length);
data.items.forEach(item => {
console.log(`- ${item.name} (ID: ${item.cltp}) - ${item.description}`);
});
} else {
console.log('❌ Column Types API call failed:', data.message);
}
} catch (error) {
console.error('❌ Error calling Column Types API:', error);
}
}
async function runTests() {
await testKeyTypesAPI();
await testColumnTypesAPI();
}
runTests();