Search code examples
restgithubgithub-api

How can I search only for issues in github repository through github rest api?


I want to get only issues and not pull requests from GitHub rest api in a specific repository, but https://api.github.com/repos/user/repo/issues endpoint returns both issues and pull requests. Github rest api docs don't say anything about searching in a specific repository. Adding q parameter to the above method does not do anything. I can't filter response to find only issues because my repository contains much more pull requests than issues. What is the way to get only issues?


Solution

  • You can use the search issues/PR API and filter with your repo path and is:issue :

    GET https://api.github.com/search/issues?q=is:issue%20repo:owner/repo
    

    For example

    Note that type:issue also works, checkout this