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

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!

1 Reply
Community Manager
Message 2 of 2

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

Hi @acazacu,

 

Thank you for being here and apologies for the delay in response. At first look this seems like an authentication error, thought as you've shared the token works for other requests. Since this is in a private repository the quickest way to get you help would be to open a support ticket If you haven't already, please contact us at https://github.com/contact with the info so we can look into that further.


Best,
Andrea


Best,
AndreaG

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!