Request to enable the CORS Header for the Word Cloud API

Hello,

I hope this message finds you well. I am a web developer currently working on a project that relies on the Quickchart Word Cloud API to generate word clouds. I really love the Word Cloud API and would like to thank you for making it available. It has been instrumental in enhancing my application’s functionality.

I am reaching out to request your assistance with a CORS (Cross-Origin Resource Sharing) issue that I have encountered while using the Word Cloud API. My frontend application, built with ReactJS and hosted at “http://localhost:3000,” is unable to make requests to the API due to the “No ‘Access-Control-Allow-Origin’ header is present on the requested resource” error. :confused:

Understanding the importance of CORS in ensuring secure communication, I kindly request you to enable the necessary “Access-Control-Allow-Origin” header in the Word Cloud API responses. This would allow my application to access the API without any CORS restrictions, thereby enhancing our user experience.

I am confident that enabling CORS headers would not only benefit our application but also foster easier integration for the broader developer community. :smiley:

I sincerely appreciate your consideration and look forward to your positive response. :blush:

Thank you for your time and support.

Best regards,
S Afnan K

Hi Afnan,

Are you sure that CORS is not enabled? The following code works well on localhost:

<script>
  const resp = fetch('https://quickchart.io/wordcloud', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      format: 'png',
      text: 'To be or not to be, that is the question',
    }),
  });

  // The above fetch returns an image. Render it on the page.
  resp.then(async (response) => {
    const data = await response.blob();
    const img = document.createElement('img');
    img.src = URL.createObjectURL(data);
    document.body.appendChild(img);
  });
</script>

Hi Ian,
Thanks a lot for your response and support. I tried using the API again and it worked! No CORS error. I suspect it might’ve been a browser issue on my end. Thanks again.