akonsu
akonsu

Reputation: 29538

github api does not return my post-receive web hook

I have manually added a web hook to my repository, but when I query the repository using the API I get

{
  "message": "Not Found"
}

what is wrong?

the url: https://api.github.com/repos/akonsu/kamyanov-art.com/hooks/

Upvotes: 5

Views: 1815

Answers (2)

Ivan Zuzak
Ivan Zuzak

Reputation: 18762

You are probably trying to access the API endpoint without authorising (in which case he API will return a 404 response and the JSON error you mentioned). Try passing your credentials with:

curl -v -u akonsu https://api.github.com/repos/akonsu/kamyanov-art.com/hooks

Upvotes: 2

VonC
VonC

Reputation: 1323223

First, don't put the extra '/' at the end.
That will get you an message "Not Found" every time, authenticated or not.

Second, to add to Ivan's answer, you need to authenticate to access that information about a repo (public or private).

As mentioned in the "API Getting Started" page:

HTTP/1.1 404 Not Found

{
    "message": "Not Found"
}

Oh noes! Where did it go?
If you’re a grizzled HTTP user, you might expect a 403 instead.
Since we don’t want to leak information about private repositories, the GitHub API returns a 404 in this case, as if to say “we can neither confirm nor deny the existence of this repository.”

That is why you see a "Not Found" here.

See issue 294

fwiw, I was scratching my head on this same issue trying to debug a hook, and the solution was to pass basic authentication on the request.

Upvotes: 4

Related Questions