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

339
Visualizações
Github user finder api, how to return multiple users per search? JS

Hello I am using github api to create github user finder. my question is how to manipulate on api link to get users which include e.target.value of the searchbar and not only that one that exactly matches.

here is my code

const [finalData, setFinalData] = useState([]);

const handleSearch = async (e) => {
try {
  const URL = `https://api.github.com/users/${e.target.value}? 
  client_id=e25d1dbedde5215999ef&client_secret=ee080580b7c4f19688ccaef6844c3fe88bb811d`;

  Promise.all([fetch(URL).then((res) => res.json())]).then((data) => {
    if (data) {
      setData(data);
    }
  });
  } catch (err) {
  console.log(err);
  }
  };

 const setData = (data) => {
  data && setFinalData(data);
  };
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You can use the Search users endpoint. There is a query parameter (q) that allows you to use multiple search criteria documented here

Here's an example using Octokit, but if you still want to use fetch, the endpoint should be https://api.github.com/search/users

Note: I really hope the client secret you are exposing here is for a test application.

Search GitHub users                                                                                 View in Fusebit
const userSearch = ''; // Specify the search text here
const usersResponse = await octokit.rest.search.users({
   q: userSearch,
   per_page:100
});

const { total_count, items } = usersResponse.data;
console.log(`Listing ${items.length} users of ${total_count} \n`, items.map(user => user.login));

over 4 years ago · Santiago Trujillo Relatório
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