Reputation: 84
I am trying to list status of commits for a repository using github rest api.
The repository is under organisation and is private.
The repos_url
of which is https://api.github.com/orgs/mydummyorg/repos
Users with pull access can view commit statuses for a given ref:
GET /repos/:owner/:repo/commits/:ref/statuses
As per the api above is the GET url
So my final url will be repos_ulr + :owner/:repo/commits/:ref/statuses
If I do the curl as below then it is giving 404 not found
curl -u "username" https://api.github.com/orgs/mydummyorg/repos/:owner:repos/commits/:ref/statuses
Where:
:owner
= username (my login id in git) :repos
= repository name under 'mydummyorg :ref
= sha of the commit`I don't know what am I doing wrong. Is my url proper?
And the value that I am passing for :owner
, :repos
, :ref
correct?
Upvotes: 2
Views: 1525
Reputation: 1323145
All I can see is:
:owner/:repos
(maybe a typo in your question, or you forgot a '/
')GET /repos/:owner/:repo/commits/:ref/statuses
means the "List Statuses for a specific Ref" API should be
https://api.github.com/ + /repos/:owner/:repo/commits/:ref/statuses
(not orgs/mydummyorg/
in front of /repos/:owner/:repo/commits/:ref/statuses
)
Finally, you need to be registered as the owner or collaborator on that private repo, or even if you do pass your complete credentials (username + password), the answer will always be 404.
Make sure you didn't activate 2FA, or your username+password wouldn't work (you would need to use a PAT -- Personal Access Token -- instead)
The OP Bhavik Shah details in the comments:
I was able to resolve the issue.
The owner detail that I was passing was wrong. It should be organisation name under which the repository is present.
Upvotes: 1