Use a Query to Find Specific Information

We Need More Information

We are working our way to our first mutation. The first mutation will be to add a comment to an existing issue containing the list of repositories you just created.

When we look at the documentation for adding a comment, we will see that the list of inputs includes a subjectId and body. We can tell these are required because they have an ! next to the data type (ID!).

Let’s build another query to get the ID of for the issue where we want to place our list of repositories.

animated gif of instructions outlined below

  1. Open an issue in our shared class repository: https://github.com/githubschool/graph-ql
  2. Create the query to find your issue ID number
    • We have started the query for you below, however, we left some of the fields blank so you can try to build the query yourself. For help, check out the documentation. To see a full code example, expand the “Tell me why” section below.

        query FindIssueID {
          repository(owner: "", name: "") {
      
          }
        }
      
  3. Find the issue’s id in your results and put it in a safe place. We’ll need it for the next step when we build a mutation.
Tell me why

Did building the query give you trouble? That’s OK! Here’s the full query. Paste it into the GraphQL Explorer to get the issue id for your own issue, just be sure to replace # with the number of your own issue.

query FindIssueID {
  repository(owner: "githubschool", name: "graph-QL") {
    issue(number: #) {
      id
    }
  }
}
Stuck? Open an issue in the repository for this class and mention @githubteacher for help from one of the GitHub trainers!
Continue