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

consistency of 'repository.url' between event types

Solved! Go to Solution.

Depending on which event you listen to, the attribute 'repository.url' is different:

- for push events it is equal to the 'html_url' attribute & points to the html repository URL not the api URI of the repository

    "url": "https://github.com/McFoggy/github-api-events"

- for create & other events it is the api URI of the repository and not the html URL.

    "url": "https://api.github.com/repos/McFoggy/github-api-events",

 

If we look at the repository payload in the API v3 documentation (https://developer.github.com/v3/repos/#response) it should point to the API URL.

 

Is it for historical reasons or is it a bug?

Is it consistent between github.com & private on premise github installations?

Are there other known inconsistencies?

 

It is important to me because I am developping software & plugins that target both type of installations.

 

In both payload below 'repository.url' attributes are differents:

 

Push event payload

 

  "repository": {
    "id": 178348886,
    "node_id": "MDEwOlJlcG9zaXRvcnkxNzgzNDg4ODY=",
    "name": "github-api-events",
    "full_name": "McFoggy/github-api-events",
    "private": false,
    "owner": {
      "name": "McFoggy",
      ...
    },
    "html_url": "https://github.com/McFoggy/github-api-events",
    "url": "https://github.com/McFoggy/github-api-events",
    "forks_url": "https://api.github.com/repos/McFoggy/github-api-events/forks",
    ...
}

 

 

Create & other events payload

 

  "repository": {
    "id": 178348886,
    "node_id": "MDEwOlJlcG9zaXRvcnkxNzgzNDg4ODY=",
    "name": "github-api-events",
    "full_name": "McFoggy/github-api-events",
    "private": false,
    "owner": {
      "login": "McFoggy",
      "id": 1119660,
      ...
    },
    "html_url": "https://github.com/McFoggy/github-api-events",
    "url": "https://api.github.com/repos/McFoggy/github-api-events",
    "forks_url": "https://api.github.com/repos/McFoggy/github-api-events/forks",
    ...
}

 

 

 

I collected complete payloads of webhooks in an example project: https://github.com/McFoggy/github-api-events/blob/master/README.md

 

6 Replies
Copilot Lvl 3
Message 2 of 7

Re: consistency of 'repository.url' between event types

PING

 

Does someone know how the on premise enterprise edition reacts in this case?

Is the payload the same as the github.com API or does it conform to the documentation?

 

Thank for any help that could be provided.

Community Manager
Message 3 of 7

Re: consistency of 'repository.url' between event types

It appears to be a bug but I haven't been able to confirm that with the development team at this time. I don't know if there are any other inconsistencies, no. I can't promise if or when this would be fixed, unfortunately.

 

My recommendation, at least for now, would be to use the documented v3 REST API URLs for retrieving information rather than relying on the API URLs in the event objects themselves.

 

I hope that helps!

Pilot Lvl 1
Message 4 of 7

Re: consistency of 'repository.url' between event types

Yeah, that's what I ended up doing as well. But a proper fix would be great to have :)

Solution
Copilot Lvl 3
Message 5 of 7

Re: consistency of 'repository.url' between event types


@lee-dohm wrote:

My recommendation, at least for now, would be to use the documented v3 REST API URLs for retrieving information rather than relying on the API URLs in the event objects themselves.


But when you have a webservice/application/integration that listens to a webhook event  ; in order to call back the server which fired the webhook you have to use the 'repository.url' field which contains a wrong value ;-)

 

I'll implement some logic (receiver side of the webhook) to detect which field contains the good value.

Copilot Lvl 3
Message 6 of 7

Re: consistency of 'repository.url' between event types

@lee-dohm any news from the dev team?

Community Manager
Message 7 of 7

Re: consistency of 'repository.url' between event types

Nope, my recommendation still stands. Use the documented endpoints. Or you could convert to using the GraphQL v4 API which only has one endpoint to use for everything.