Go-github: A note regarding baseURL's for enterprise Github instances.

Created on 25 Jul 2018  路  2Comments  路  Source: google/go-github

To whomsoever it may concern,

There is an important caveat regarding the baseURL when creating clients for enterprise Github instances ( for example with the NewEnterpriseClient method).

The baseURL of the public facing API is simply: https://api.github.com/"
However for enterprise Github instances the baseURL for the API is slightly different: https://<mycompany>.github.com/api/v3/"

Using a baseURL without the /api/v3/ suffix will result in HTTP 406 Not Acceptable errors and lead you down a path of debugging Oauth clients and request headers. I learnt this after many hours and tears.

Documenting this as an issue to help others in the future. Perhaps we could add note on the godoc regarding the difference in baseURL structures between public and enterprise Github.

Most helpful comment

Thanks for the reply @gmlewis - I'll submit a PR shortly. And you're right about the baseURL, it should be https://github.<mycompany>.com/api/v3/ - serves me right for trying to create an issue while sleep deprived haha.

All 2 comments

Thank you, @vanugrah! We definitely want to make life easier for Enterprise GitHub users of this package.

We would greatly appreciate PRs that would help others to reduce or eliminate their pain points. If you or others could create these PRs (who are actually using this package with Enterprise GitHub), that would be excellent.

Also, wouldn't the baseURL be https://github.<mycompany>.com/api/v3/ for Enterprise users?

Thanks for the reply @gmlewis - I'll submit a PR shortly. And you're right about the baseURL, it should be https://github.<mycompany>.com/api/v3/ - serves me right for trying to create an issue while sleep deprived haha.

Was this page helpful?
0 / 5 - 0 ratings