Is there way to specify period in GitHub API v4?

How to write to get a list of issues created between 2017-01-01 and 2017-12-31 in GitHub API v4 …?

What statement should I add to this query…? 

query{
            repository(owner: "kubernetes", name: "kubernetes"){
                getTime: issues(first: 100, orderBy:{direction:ASC, field: CREATED_AT}){
                    edges{
                        node{
                            title
                            createdAt
                            closedAt
                        }
                    }
                }
            }
        }

You have to use the Search API to perform that kind of query:

{
  search(first: 100, query: "repo:kubernetes/kubernetes is:issue created:2017-01-01..2017-12-31", type: ISSUE) {
    nodes {
      ... on Issue {
        title
        createdAt
        closedAt
      }
    }
  }
}

You can’t sort the results, but you can paginate through all the results.

I hope that helps!

1 Like