Search code examples
curlgithubgithub-apigithub-api-v3

Unable to Create an Issue for an Organization Repo Using GitHub API v3


I want to create an issue for an org repo using enterprise GitHub API, but unable to do that with curl

I am using

curl -u $username -d '{"title":"Big Files List", "label":"big files","body": "'$(find  -type f -size +150M)'"}'    https://$hostname/api/v3/repos/orgs/$orgName/$repoName/issues -k

The message in the response I got back was "Not Found"

I've checked https://developer.github.com/v3/issues/#create-an-issue, which only talks about user's repo instead of organization repo.


Solution

  • Considering an organization repository is a Git repo following the same URL structure as any other repos, you can still follow GitHub API V3 issue "create an issue"

    curl -k -u $username \
         -d '{"title":"Big Files List", "label":"big files","body": "'$(find  -type f -size +150M)'"}' \
         https://$hostname/api/v3/repos/$orgName/$repoName/issues
                                 ^^^^^^^^^^^^^^^