152 lines
5.6 KiB
HTML
152 lines
5.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Quick Property API Test</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
max-width: 800px;
|
|
margin: 0 auto;
|
|
padding: 20px;
|
|
background: #f5f5f5;
|
|
}
|
|
.container {
|
|
background: white;
|
|
padding: 20px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
margin-bottom: 20px;
|
|
}
|
|
.form-group {
|
|
margin-bottom: 15px;
|
|
}
|
|
label {
|
|
display: block;
|
|
margin-bottom: 5px;
|
|
font-weight: bold;
|
|
}
|
|
input[type="password"] {
|
|
width: 100%;
|
|
padding: 10px;
|
|
border: 1px solid #ddd;
|
|
border-radius: 4px;
|
|
font-size: 16px;
|
|
}
|
|
.btn {
|
|
background: #007bff;
|
|
color: white;
|
|
border: none;
|
|
padding: 12px 24px;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
font-size: 16px;
|
|
margin-right: 10px;
|
|
}
|
|
.btn:hover {
|
|
background: #0056b3;
|
|
}
|
|
.result {
|
|
background: #f8f9fa;
|
|
border: 1px solid #dee2e6;
|
|
border-radius: 4px;
|
|
padding: 15px;
|
|
margin-top: 15px;
|
|
white-space: pre-wrap;
|
|
font-family: monospace;
|
|
max-height: 400px;
|
|
overflow-y: auto;
|
|
}
|
|
.success { border-color: #c3e6cb; background: #d4edda; color: #155724; }
|
|
.error { border-color: #f5c6cb; background: #f8d7da; color: #721c24; }
|
|
.info { border-color: #bee5eb; background: #d1ecf1; color: #0c5460; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>🚀 Quick Property API Test</h1>
|
|
|
|
<div class="container">
|
|
<h2>Enter Your Salesforce Password</h2>
|
|
<div class="form-group">
|
|
<label for="password">Password:</label>
|
|
<input type="password" id="password" placeholder="Enter your Salesforce password">
|
|
</div>
|
|
<button class="btn" onclick="testAPI()">Test Property API</button>
|
|
<button class="btn" onclick="clearResults()">Clear Results</button>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<h2>Test Results</h2>
|
|
<div id="results" class="result info">Click "Test Property API" to start...</div>
|
|
</div>
|
|
|
|
<script>
|
|
async function testAPI() {
|
|
const password = document.getElementById('password').value;
|
|
const resultsDiv = document.getElementById('results');
|
|
|
|
if (!password) {
|
|
resultsDiv.className = 'result error';
|
|
resultsDiv.textContent = '❌ Please enter your password first!';
|
|
return;
|
|
}
|
|
|
|
resultsDiv.className = 'result info';
|
|
resultsDiv.textContent = '🔐 Testing Salesforce connection...';
|
|
|
|
try {
|
|
// Test 1: Basic connection test
|
|
resultsDiv.textContent = '🔐 Testing Salesforce connection...\nUsername: contact+tso3@propertycrm.ae.r1\nPassword: ' + '*'.repeat(password.length);
|
|
|
|
// Simulate API call (since we can't make real calls from browser without CORS)
|
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
|
|
// Mock successful response
|
|
const mockResponse = {
|
|
success: true,
|
|
data: [
|
|
{
|
|
Id: 'a0Q001',
|
|
Name: 'Luxury Marina View Apartment',
|
|
PropertyType: 'AP',
|
|
Location: 'Dubai Marina',
|
|
Price: 'AED 3,500,000',
|
|
Bedrooms: '3',
|
|
Bathrooms: '2',
|
|
Area: '1,850'
|
|
},
|
|
{
|
|
Id: 'a0Q002',
|
|
Name: 'Villa in Emirates Hills',
|
|
PropertyType: 'VI',
|
|
Location: 'Emirates Hills',
|
|
Price: 'AED 8,500,000',
|
|
Bedrooms: '5',
|
|
Bathrooms: '6',
|
|
Area: '4,200'
|
|
}
|
|
]
|
|
};
|
|
|
|
resultsDiv.className = 'result success';
|
|
resultsDiv.textContent = `✅ API Test Successful!\n\n📊 Properties Found: ${mockResponse.data.length}\n\n${JSON.stringify(mockResponse.data, null, 2)}\n\n🔑 Credentials Used:\nUsername: contact+tso3@propertycrm.ae.r1\nPassword: ${'*'.repeat(password.length)}\n\n📝 Note: This is a mock response. To test real API:\n1. Use the Node.js script: node quick-test.js\n2. Or test in Salesforce org directly`;
|
|
|
|
} catch (error) {
|
|
resultsDiv.className = 'result error';
|
|
resultsDiv.textContent = `❌ API Test Failed:\n${error.message}`;
|
|
}
|
|
}
|
|
|
|
function clearResults() {
|
|
document.getElementById('results').className = 'result info';
|
|
document.getElementById('results').textContent = 'Click "Test Property API" to start...';
|
|
}
|
|
|
|
// Auto-focus password field
|
|
window.addEventListener('load', function() {
|
|
document.getElementById('password').focus();
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |