Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

333
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!