import axios from 'axios'; async function main() { const storeId = 'best'; const baseUrl = `https://headless.treez.io/v2.0/dispensary/${storeId}`; // Try various endpoints const endpoints = [ '/ecommerce/discounts?excludeInactive=true&hideUnset=true&includeProdInfo=true', '/ecommerce/products', '/products', '/menu', '/inventory', '/catalog', ]; console.log('Testing Treez Headless API endpoints...\n'); for (const endpoint of endpoints) { const url = baseUrl + endpoint; console.log('GET ' + url); try { const response = await axios.get(url, { headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', }, timeout: 10000, }); console.log(' Status: ' + response.status); const data = response.data; if (Array.isArray(data)) { console.log(' Array length: ' + data.length); if (data.length > 0) { console.log(' First item keys: ' + Object.keys(data[0]).join(', ')); console.log(' Sample: ' + JSON.stringify(data[0]).slice(0, 300)); } } else if (typeof data === 'object') { console.log(' Keys: ' + Object.keys(data).join(', ')); console.log(' Sample: ' + JSON.stringify(data).slice(0, 500)); } console.log(''); } catch (err: any) { console.log(' Error: ' + (err.response?.status || err.message)); if (err.response?.data) { console.log(' Data: ' + JSON.stringify(err.response.data).slice(0, 200)); } console.log(''); } } } main();