RWM API Browser Smoke Test
body { font-family: system-ui, -apple-system, Segoe UI, Arial, sans-serif; margin: 2rem; }
pre { background: #111; color: #eee; padding: 1rem; overflow:auto; border-radius: 8px; }
.ok { color: #0a0; } .err { color: #c00; }
RateWhatMatters – Browser Smoke Tests
HotelCode for ratings:
Run Tests
/api/ratables
…
/api/hotels?q=fort worth
…
POST /api/stays
…
/api/ratings/{HotelCode}
…
async function show(id, promise){
const el = document.getElementById(id);
try {
const res = await promise;
const txt = await res.text();
el.textContent = `HTTP ${res.status}\n` + txt;
} catch(e){
el.textContent = ‘ERROR: ‘ + e;
}
}
document.getElementById(‘run’).onclick = async () => {
const base = ‘
https://ratewhatmatters.com’;
const hotelCode = document.getElementById(‘hotelCode’).value.trim() || ‘1094195’;
await show(‘ratables’, fetch(`${base}/api/ratables`));
await show(‘hotels’, fetch(`${base}/api/hotels?q=${encodeURIComponent(‘fort worth’)}`));
const stayBody = {
HotelCode: Number(hotelCode),
StayType: “Personal”,
ContributorEmail: “jeff@example.com”,
CheckInDate: “2025-09-28”,
CheckOutDate: “2025-09-30”,
Ratings: [
{ MetricID: 1, Value: 1 }, // boolean metric: 0 or 1
{ MetricID: 2, Value: 7 } // scale metric example
]
};
await show(‘stays’, fetch(`${base}/api/stays`, {
method: ‘POST’,
headers: {‘Content-Type’:’application/json’},
body: JSON.stringify(stayBody)
}));
await show(‘ratings’, fetch(`${base}/api/ratings/${encodeURIComponent(hotelCode)}`));
};