Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

171
Visualizações
how do i get the discord role data from a guild using an API call

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

const url="https://discord.com/api/v9/guilds/792895591255769098/members/search"

function callAPI() {
  var xhttp = new XMLHttpRequest();
  xhttp.open('GET', url);
  xhttp.setRequestHeader('Authorization', 'Bot <my bots token>');
  xhttp.send();
  console.log("sent request")
  console.log(xhttp)
}
callAPI.call() 

I also tried this code too but it returns the same result

async function getGuildRoles(){
  const response = await fetch('https://discord.com/api/guilds/792895591255769098/members',{
    method:'GET',
    headers: {
      Authorization: 'Bot <my bots token>'

    }
  });
  console.log(response.text());
  return response;
}
getGuildRoles.call()
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda