diff --git a/components/lib/get-rest-code-samples.ts b/components/lib/get-rest-code-samples.ts index 27c6a7f4ec44..be97ce6129a8 100644 --- a/components/lib/get-rest-code-samples.ts +++ b/components/lib/get-rest-code-samples.ts @@ -43,9 +43,14 @@ export function getShellExample(operation: Operation, codeSample: CodeSample) { } } + let authHeader = '-H "Authorization: Bearer "' + if (operation.subcategory === 'management-console') { + authHeader = '-u "api_key:your-password"' + } + const args = [ operation.verb !== 'get' && `-X ${operation.verb.toUpperCase()}`, - `-H "Accept: ${defaultAcceptHeader}" \\ \n -H "Authorization: Bearer "`, + `-H "Accept: ${defaultAcceptHeader}" \\ \n ${authHeader}`, `${operation.serverUrl}${requestPath}`, requestBodyParams, ].filter(Boolean) diff --git a/components/rest/RestCodeSamples.tsx b/components/rest/RestCodeSamples.tsx index 0ceeb6f37ac0..5b0e3b6d015e 100644 --- a/components/rest/RestCodeSamples.tsx +++ b/components/rest/RestCodeSamples.tsx @@ -60,14 +60,17 @@ export function RestCodeSamples({ operation, slug }: Props) { })) // Menu options for the language selector - const languageSelectOptions: LanguageOptionT[] = [ - { key: CURLKEY, text: 'cURL' }, - { key: JSKEY, text: 'JavaScript' }, - ] - // Not all examples support the GH CLI language option. If any of - // the examples don't support it, we don't show GH CLI as an option. - if (!languageExamples.some((example) => example.ghcli === undefined)) { - languageSelectOptions.push({ key: GHCLIKEY, text: 'GitHub CLI' }) + const languageSelectOptions: LanguageOptionT[] = [{ key: CURLKEY, text: 'cURL' }] + + // Management Console operations are not supported by Octokit + if (operation.subcategory !== 'management-console') { + languageSelectOptions.push({ key: JSKEY, text: 'JavaScript' }) + + // Not all examples support the GH CLI language option. If any of + // the examples don't support it, we don't show GH CLI as an option. + if (!languageExamples.some((example) => example.ghcli === undefined)) { + languageSelectOptions.push({ key: GHCLIKEY, text: 'GitHub CLI' }) + } } // Menu options for the example selector