Introduction
Your first test
Before integrating the API into your application, verify connectivity with a health check and a simple authenticated request.
1) Smoke test the service
/System/Echo verifies the service is reachable.
const baseUrl = 'https://api.hlc.bike/us/v3.0'
const echoRes = await fetch(`${baseUrl}/System/Echo`)
if (!echoRes.ok) throw new Error(`Echo failed: ${echoRes.status}`)
2) First call (brands)
const apiKey = process.env.HLC_API_KEY
const brandsRes = await fetch(`${baseUrl}/Catalog/Brands`, {
headers: {
ApiKey: apiKey,
language: 'en',
callerName: 'first-test',
},
})
if (!brandsRes.ok) throw new Error(`Auth failed: ${brandsRes.status}`)
const brands = await brandsRes.json()
Use case: Add this to CI to block deployments if the API is unreachable or the token is invalid.