title: how do i get the discord role data from a guild using an API call
body: <p>i have this code in JS however it always returns a 403 error when i run it in my website. I have tried to run the same request with python and in postman and it gave me the data i wanted so the API is definitly not the problem.
  it also gave me a CORS error which i resolved by getting a chrome extension but i am not sure if that is the problem</p>
  <pre><code>const url=&quot;https://discord.com/api/v9/guilds/792895591255769098/members/search&quot;
  
  function callAPI() {
    var xhttp = new XMLHttpRequest();
    xhttp.open('GET', url);
    xhttp.setRequestHeader('Authorization', 'Bot &lt;my bots token&gt;');
    xhttp.send();
    console.log(&quot;sent request&quot;)
    console.log(xhttp)
  }
  callAPI.call() 
  </code></pre>
  <p>I also tried this code too but it returns the same result</p>
  <pre><code>async function getGuildRoles(){
    const response = await fetch('https://discord.com/api/guilds/792895591255769098/members',{
      method:'GET',
      headers: {
        Authorization: 'Bot &lt;my bots token&gt;'
  
      }
    });
    console.log(response.text());
    return response;
  }
  getGuildRoles.call()
  </code></pre>