From 38f399fdaa1847fc886cca32eeeafee48b32419b Mon Sep 17 00:00:00 2001 From: Lucas Costi Date: Fri, 5 Feb 2021 15:33:35 +1000 Subject: [PATCH] Version API URL reusables for GHAE (#17674) --- .../developers/apps/authenticating-with-github-apps.md | 2 +- content/rest/overview/resources-in-the-rest-api.md | 8 ++++---- data/variables/product.yml | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/content/developers/apps/authenticating-with-github-apps.md b/content/developers/apps/authenticating-with-github-apps.md index c09dc6e3de..45b446f810 100644 --- a/content/developers/apps/authenticating-with-github-apps.md +++ b/content/developers/apps/authenticating-with-github-apps.md @@ -112,7 +112,7 @@ The example above uses the maximum expiration time of 10 minutes, after which th ```json { "message": "'Expiration' claim ('exp') must be a numeric value representing the future time at which the assertion expires.", - "documentation_url": "{% data variables.product.doc_url_pre %}/v3" + "documentation_url": "{% data variables.product.doc_url_pre %}" } ``` diff --git a/content/rest/overview/resources-in-the-rest-api.md b/content/rest/overview/resources-in-the-rest-api.md index 812762ce3b..ef7a03c456 100644 --- a/content/rest/overview/resources-in-the-rest-api.md +++ b/content/rest/overview/resources-in-the-rest-api.md @@ -142,7 +142,7 @@ $ curl -I {% data variables.product.api_url_pre %} -u foo:bar > { > "message": "Bad credentials", -> "documentation_url": "{% data variables.product.doc_url_pre %}/v3" +> "documentation_url": "{% data variables.product.doc_url_pre %}" > } ``` @@ -156,7 +156,7 @@ $ curl -i {% data variables.product.api_url_pre %} -u {% if currentVersion == "f > HTTP/1.1 403 Forbidden > { > "message": "Maximum number of login attempts exceeded. Please try again later.", -> "documentation_url": "{% data variables.product.doc_url_pre %}/v3" +> "documentation_url": "{% data variables.product.doc_url_pre %}" > } ``` @@ -403,7 +403,7 @@ If you exceed the rate limit, an error response returns: > { > "message": "API rate limit exceeded for xxx.xxx.xxx.xxx. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)", -> "documentation_url": "{% data variables.product.doc_url_pre %}/v3/#rate-limiting" +> "documentation_url": "{% data variables.product.doc_url_pre %}/overview/resources-in-the-rest-api#rate-limiting" > } ``` @@ -448,7 +448,7 @@ If your application triggers this rate limit, you'll receive an informative resp > { > "message": "You have triggered an abuse detection mechanism and have been temporarily blocked from content creation. Please retry your request again later.", -> "documentation_url": "{% data variables.product.doc_url_pre %}/v3/#abuse-rate-limits" +> "documentation_url": "{% data variables.product.doc_url_pre %}/overview/resources-in-the-rest-api#abuse-rate-limits" > } ``` diff --git a/data/variables/product.yml b/data/variables/product.yml index e7a231d9fd..6e3e2ca493 100644 --- a/data/variables/product.yml +++ b/data/variables/product.yml @@ -183,10 +183,10 @@ current-340-version: '11.10.354' # Developer site product variables # Use this inside command-line and other code blocks doc_url_pre: >- - {% if currentVersion == "free-pro-team@latest" %}https://developer.github.com{% else %}https://developer.github.com/enterprise/{{currentVersion}}{% endif %} + {% if currentVersion == "free-pro-team@latest" %}https://docs.github.com/rest{% elsif enterpriseServerVersions contains currentVersion %}https://docs.github.com/enterprise/{{ currentVersion | version_num }}/rest{% elsif currentVersion == "github-ae@latest" %}https://docs.github.com/github-ae@latest/rest{% endif %} # Use this inside command-line code blocks api_url_pre: >- - {% if currentVersion == "free-pro-team@latest" %}https://api.github.com{% else %}http(s)://[hostname]/api/v3{% endif %} + {% if currentVersion == "free-pro-team@latest" %}https://api.github.com{% elsif enterpriseServerVersions contains currentVersion %}http(s)://[hostname]/api/v3{% elsif currentVersion == "github-ae@latest" %}https://api.[hostname]{% endif %} # Use this inside command-line code blocks # Enterprise OAuth paths that don't include "/graphql" or "/api/v3" oauth_host_code: >- @@ -195,10 +195,10 @@ device_authorization_url: >- {% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.21" or currentVersion == "github-ae@latest" %}[`https://github.com/login/device`](https://github.com/login/device){% else %}`http(s)://[hostname]/login/device`{% endif %} # Use this all other code blocks api_url_code: >- - {% if currentVersion == "free-pro-team@latest" %}https://api.github.com{% else %}http(s)://[hostname]/api/v3{% endif %} + {% if currentVersion == "free-pro-team@latest" %}https://api.github.com{% elsif enterpriseServerVersions contains currentVersion %}http(s)://[hostname]/api/v3{% elsif currentVersion == "github-ae@latest" %}https://api.[hostname]{% endif %} # Use this inside command-line code blocks graphql_url_pre: >- - {% if currentVersion == "free-pro-team@latest" %}https://api.github.com/graphql{% else %}http(s)://[hostname]/api/graphql{% endif %} + {% if currentVersion == "free-pro-team@latest" %}https://api.github.com/graphql{% elsif enterpriseServerVersions contains currentVersion %}http(s)://[hostname]/api/graphql{% elsif currentVersion == "github-ae@latest" %}https://api.[hostname]/graphql{% endif %} # Use this all other code blocks graphql_url_code: >- - {% if currentVersion == "free-pro-team@latest" %}https://api.github.com/graphql{% else %}http(s)://[hostname]/api/graphql{% endif %} + {% if currentVersion == "free-pro-team@latest" %}https://api.github.com/graphql{% elsif enterpriseServerVersions contains currentVersion %}http(s)://[hostname]/api/graphql{% elsif currentVersion == "github-ae@latest" %}https://api.[hostname]/graphql{% endif %}