Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix api url for Github Enterprise #117

Closed
v2kiran opened this issue Jul 2, 2019 · 5 comments · Fixed by #118
Closed

Fix api url for Github Enterprise #117

v2kiran opened this issue Jul 2, 2019 · 5 comments · Fixed by #118

Comments

@v2kiran
Copy link
Contributor

v2kiran commented Jul 2, 2019

The api url has been coded in the following format:

$url = "https://api.$hostName/$UriFragment"

While this works for github it fails with the enterprise version because the api url is different:

http(s)://[hostname]/api/v3

As a result when you call any of the function referencing Github enterprise you may get the following error:

The remote name could not be resolved: 'api.myghhost.com'
At C:\Program 
Files\WindowsPowerShell\Modules\PowerShellForGitHub\0.8.0\GitHubCore.ps1:520 
char:9
+         throw $newLineOutput
+         ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (The remote name.... 
   com':String) [], RuntimeException
    + FullyQualifiedErrorId : The remote name could not be resolved: 'api.myghhost.com'

Will raise a PR to fix this.

@HowardWolosky
Copy link
Member

HowardWolosky commented Jul 2, 2019

That sounds like a dupe of #101 (and the documentation for that feature can be found here. Please re-activate with more details if I've misunderstood.

@HowardWolosky
Copy link
Member

Actually, after you saying that not all enterprise installations have the API available at api. <hostname>?

@v2kiran
Copy link
Contributor Author

v2kiran commented Jul 2, 2019

hmm I thought all Github enterprise instances had a different api url than the public github.com. This has been the case in my current setup as well as the last place I worked.

Are you saying that there are some github enterprise instances that are accessible at : api.ghhost?

https://developer.github.com/enterprise/2.16/v3/#current-version

@HowardWolosky
Copy link
Member

That was the case for @Cellivar who implemented #101... Reading the docs, it appears not to be the required case. Re-opening this issue. Feel free to provide a PR.

@HowardWolosky HowardWolosky reopened this Jul 2, 2019
@Cellivar
Copy link
Contributor

Cellivar commented Jul 9, 2019

To my knowledge both API endpoints work with a strong preference from GitHub support for the api.(domain) endpoint. We have seen integrations using either one to no ill effect.

If your deployment doesn't expose api.(domain) that's usually a sign of a configuration issue. You can confirm the subdomain isolation configuration settings in the management console. https://help.github.com/enterprise/2.1/admin/articles/configuring-dns-ssl-and-subdomain-settings

HowardWolosky pushed a commit that referenced this issue Jul 16, 2019
Per the [documentation](https://developer.github.com/enterprise/2.16/v3/#current-version), enterprise installations support a base URL of  `http(s)://[hostname]/api/v3` in addition to the existing support of `http(s)://api.[hostname]/`.  This PR updates the module to _always_ use the `http(s)://[hostname]/api/v3` syntax when `[hostname]` is _not_ `github.com`.

Fixes #117
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants