Legacy Dev Forum Posts

 View Only

Sign Up

Download attachment in browser using api

  • 1.  Download attachment in browser using api

    Posted 06-05-2025 18:04

    Ramachandra_Chandan | 2024-09-27 21:57:12 UTC | #1

    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));

    system | 2024-10-28 21:54:08 UTC | #2

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


    This post was migrated from the old Developer Forum.

    ref: 29598