Video

Latest

Use of Github API

 Github APIs( or Github ReST APIs) are the APIs that you can use to interact with GitHub. They allow you to create and manage repositories, branches, issues, pull requests, and many more. For fetching publicly available information (like public repositories, user profiles, etc.), you can call the API.




Important URLs -

https://docs.github.com/en/rest/search#search-users

https://docs.github.com/en/search-github/searching-on-github/searching-users

https://api.github.com/search/users?q=Subhradip%20in:name


Code samples

GET/search/users
curl \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/search/users

Results : 

{ "total_count": 2, "incomplete_results": false, "items": [ { "id": 418327088, "node_id": "MDU6TGFiZWw0MTgzMjcwODg=", "url": "https://api.github.com/repos/octocat/linguist/labels/enhancement", "name": "enhancement", "color": "84b6eb", "default": true, "description": "New feature or request.", "score": 1 }, { "id": 418327086, "node_id": "MDU6TGFiZWw0MTgzMjcwODY=", "url": "https://api.github.com/repos/octocat/linguist/labels/bug", "name": "bug", "color": "ee0701", "default": true, "description": "Something isn't working.", "score": 1 } ] }


Search only users or organizations

By default, searching users will return both personal and organizations. However, you can use the type qualifier to restrict search results to personal accounts or organizations only.

QualifierExample
type:usermike in:name created:<2011-01-01 type:user matches personal accounts named "mike" that were created before 2011.
type:orgdata in:email type:org matches organizations with the word "data" in their email.

Search by account name, full name, or public email

You can filter your search to the personal user or organization account name with user or org qualifiers.

With the in qualifier you can restrict your search to the username (login), full name, public email, or any combination of these. When you omit this qualifier, only the username and email address are searched. For privacy reasons, you cannot search by email domain name.

QualifierExample
user:nameuser:octocat matches the user with the username "octocat".
org:nameorg:electron type:users matches the Electron organization's account name.
in:loginkenya in:login matches users with the word "kenya" in their username.
in:namebolton in:name matches users whose real name contains the word "bolton."
fullname:firstname lastnamefullname:nat friedman matches a user with the full name "Nat Friedman." Note: This search qualifier is sensitive to spacing.
in:emaildata in:email matches users with the word "data" in their email.

Full - https://docs.github.com/en/search-github/searching-on-github/searching-users





No comments