'Git API fetch users filtered by username
I'm searching for a mechanism to filter users by prefix. For Git API we can fetch the users filtered by location, exact name etc. But can we filter the list of users by prefix? For example fetch all the users whose username starts with "jo".
Solution 1:[1]
There is no way to guarantee these results, however I would suggest you use GitHub's GraphQL API and perform a search query. The following query is the best to get the results you want.
{
search(query: "jo", type: USER, first: 10) {
edges {
node {
... on User {
name
login
}
}
}
}
}
You can try it out on the Explorer here.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | David Butler |
