'; const url = 'https://wheelofnames.com/api/v2/wheels'; const wheel = { shareMode: 'copyable', wheelConfig: { title: 'My wheel', description: 'I created this wheel using the API!', entries: [ { text: 'Win' }, { text: 'Lose' }, { text: 'Spin again' }, ], }, }; const headers = { 'Content-Type': 'application/json', 'x-api-key': API_KEY, }; try { const response = await fetch(url, { method: 'POST', headers, body: JSON.stringify(wheel), }); const jsonResponse = await response.json(); if (jsonResponse?.data?.path) { const path = jsonResponse.data.path; console.log(`Wheel created: https://wheelofnames.com/${path}`); } else { console.log('Response not OK'); console.log(jsonResponse); } } catch (error) { console.error(error); }