graphqlgithub-apigithub-projects

How to query project notes on Github using GraphQL?


I found a project at the address https://github.com/delbaoliveira/website/projects/1. I am using the GitHub GraphQL API to retrieve the desired notes. enter image description here I also created a similar project, but the returned result is undefined. I suspect that the variable columnId is incorrect.

enter image description here

So, how can I obtain the columnId? Please help me!


Solution

  • You can get columnId with this query:

    query { 
      repository(name: "website", owner: "delbaoliveira") {
        project(number: 1) {
          name
          columns(first: 1) {
            nodes {
              id
              name
            }
          }
        }
      }
    }
    

    But also you can go ahead and get column data without columnId like this:

    query { 
      repository(name: "website", owner: "delbaoliveira") {
        project(number: 1) {
          name
          columns(first: 1) {
            nodes {
              name
              cards {
                nodes {
                  note
                }
              }
            }
          }
        }
      }
    }