Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 1

GitHubApi v3 (REST) - Search for pull request by commit sha in a private organization repository

Hi,

 

Using GitHub's REST API v3 and following documentation listed here and here, I'm trying to search for pull requests that corespond to a specific commit SHA.

 

The q parameter that I am sending in the request looks like this:

5f2e8a2+repo:owner/repo+type:pr+is:open

 

The authentication token used in the request is an application installation token. The application for which the token is generated has the Metadata permission set to ReadOnly, so it should have access to the org's private repositories, using it on any other endpoint works as intended.

 

When making the GET call to /search/issues, the response that I'm receiving is:

{
    "message": "Validation Failed",
    "errors": [
        {
            "message": "The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.",
            "resource": "Search",
            "field": "q",
            "code": "invalid"
        }
    ],
    "documentation_url": "https://developer.github.com/v3/search/"
}

 

Worth noting, using the same query string on the website:

5f2e8a2 repo:owner/repo type:pr is:open

Returns the correct results.

 

Am I doing something wrong?

 

Thank you!