search for GitHub repositories using version 4 of the GitHub API (https://developer.github.com/v4)

 search for GitHub repositories using version 4 of the GitHub API (https://developer.github.com/v4)

Please help with some url to test in Postman…

Thanks in advance

You can use the search query to search for all kinds of GitHub objects. If I wanted to search for repositories containing “atom” though, I would use:

{
  search(query: "atom", type: REPOSITORY, first: 10) {
    edges {
      node {
        ... on Repository {
          nameWithOwner
        }
      }
    }
  }
}

which results in:

{
  "data": {
    "search": {
      "edges": [
        {
          "node": {
            "nameWithOwner": "atom/atom"
          }
        },
        {
          "node": {
            "nameWithOwner": "AtomicGameEngine/AtomicGameEngine"
          }
        },
        {
          "node": {
            "nameWithOwner": "rybalkinsd/atom"
          }
        },
        {
          "node": {
            "nameWithOwner": "file-icons/atom"
          }
        },
        {
          "node": {
            "nameWithOwner": "futantan/atom"
          }
        },
        {
          "node": {
            "nameWithOwner": "atomix/atomix"
          }
        },
        {
          "node": {
            "nameWithOwner": "Glavin001/atom-beautify"
          }
        },
        {
          "node": {
            "nameWithOwner": "atom/markdown-preview"
          }
        },
        {
          "node": {
            "nameWithOwner": "amaneureka/AtomOS"
          }
        },
        {
          "node": {
            "nameWithOwner": "atom/apm"
          }
        }
      ]
    }
  }
}

The ... on Repository tells GraphQL that you want to only look at items of type Repository.

4 Likes