[Solved] Query by date within repository


#1

I am trying to use the GraphQL API to query a specific repo for data within a date range. Using the search object, I have been able to query for specific date ranges:

query {
	search (first: 3, type:ISSUE, query: "createdDate:>2018-03-01") {
 		nodes {
 			__typename
 		}
 	}
}

And I can query for specific types of objects within a repo:

repository(owner:"githubschool",name:"graph-QL") {
	pullRequests(last: 10){
		edges {
			node {
				number
				createdAt
				closedAt
			}
		}
	}
}

But I have not been able to combine these two features to search within a date range for a specific object within a specific repository. Some guidance would be much appreciated.


#2

I still haven’t been able to identify a schema that will allow me to do this. Any suggestions would be greatly appreciated.


#3

Hi @ctrom!

I think in the query field you can use the same search terminology as is used in the V3 API: https://developer.github.com/v3/search/#search-issues. So, you can add repo:githubschool/graph-QL to your query string to search within that repo.

I was able to get some results with

query {
  search (first: 3, type:ISSUE, query: "repo:githubschool/graph-QL created:>2018-03-01") {
    nodes {
      ... on Issue {
        number
          createdAt
          closedAt
      }
    }
  }
}

#4

Thanks @rlinehan, your example was enough to get me started.


#5

This topic was automatically closed after 21 hours. New replies are no longer allowed.