Code viewer for World: hello world
document.write(`
    <h1>API Hello World</h1>

    <script>
        // Replace 'YOUR_API_KEY' with your actual API key
        const apiKey = 'CtJG5HSMq7i1ggbhqnvc6n0x0iFnx9oWwZ6VFmcd';

        // URL of the API
        const apiUrl = 'https://api.example.com/endpoint?key=' + apiKey;

        // Call the API using fetch
        fetch(apiUrl)
            .then(response => {
                if (!response.ok) {
                    throw new Error('HTTP error! Status: ' + response.status);
                }
                return response.json();
            })
            .then(data => {
                // Handle the API response data
                console.log(data);
            })
            .catch(error => {
                // Handle errors
                console.error('Error:', error);
            });
    </script>
`);