Download attachment in browser using api

https://api.usw2.pure.cloud/api/v2/downloads/35d2f1895912f4a8

Is it possible to make this call from browser to get binary content ? I keep getting CORS error in the browser. I am trying to make this call from custom interaction widget application.

  var myHeaders = new Headers();
  myHeaders.append('Content-Type', 'application/json');
  myHeaders.append('Accept', 'application/json');
  myHeaders.append('sec-fetch-mode', 'cors');
  myHeaders.append(
    'authorization',
    'Bearer sdgssfsfsfsfsf',
  );

    fetch('https://api.usw2.pure.cloud/api/v2/downloads/35d2f1895912f4a8', {
      method: 'GET',
      headers: myHeaders,
      redirect: 'follow',
    })
      .then((response) => response.text())
      .then((result) => console.log(result))
      .catch((error) => console.log('error', error));

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.