Skip to main content
REST API はバージョン管理になりました。 詳細については、「API のバージョン管理について」を参照してください。

Codespaces マシン用 REST API エンドポイント

REST API を使って、codespace 用に使えるマシン タイプを管理できます。

Codespaces マシンについて

特定のリポジトリに、または認証済みユーザーとして、codespace の作成に使えるマシン タイプを決めることができます。 詳しくは、「codespace のマシンの種類を変更する」を参照してください。

また、この情報は、既存の codespace のマシンを、その machine プロパティを更新することで変更する場合にも、参照することができます。 マシンの更新は、次回 codepace が起動するときに実行されます。 詳しくは、「codespace のマシンの種類を変更する」を参照してください。

List available machine types for a repository

List the machine types available for a given repository based on its configuration.

OAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.

"List available machine types for a repository" のきめ細かいアクセス トークン

このエンドポイントは、次のトークンの種類で動作します:

トークンには次のアクセス許可が設定されている必要があります:

  • codespaces_metadata:read

"List available machine types for a repository" のパラメーター

ヘッダー
名前, Type, 説明
accept string

Setting to application/vnd.github+json is recommended.

パス パラメーター
名前, Type, 説明
owner string 必須

The account owner of the repository. The name is not case sensitive.

repo string 必須

The name of the repository without the .git extension. The name is not case sensitive.

クエリ パラメーター
名前, Type, 説明
location string

The location to check for available machines. Assigned by IP if not provided.

client_ip string

IP for location auto-detection when proxying a request

ref string

The branch or commit to check for prebuild availability and devcontainer restrictions.

"List available machine types for a repository" の HTTP 応答状態コード

状態コード説明
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

404

Resource not found

500

Internal Error

"List available machine types for a repository" のコード サンプル

要求の例

get/repos/{owner}/{repo}/codespaces/machines
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/codespaces/machines

Response

Status: 200
{ "total_count": 2, "machines": [ { "name": "standardLinux", "display_name": "4 cores, 16 GB RAM, 64 GB storage", "operating_system": "linux", "storage_in_bytes": 68719476736, "memory_in_bytes": 17179869184, "cpus": 4 }, { "name": "premiumLinux", "display_name": "8 cores, 32 GB RAM, 64 GB storage", "operating_system": "linux", "storage_in_bytes": 68719476736, "memory_in_bytes": 34359738368, "cpus": 8 } ] }

List machine types for a codespace

List the machine types a codespace can transition to use.

OAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.

"List machine types for a codespace" のきめ細かいアクセス トークン

このエンドポイントは、次のトークンの種類で動作します:

トークンには次のアクセス許可が設定されている必要があります:

  • codespaces_metadata:read

"List machine types for a codespace" のパラメーター

ヘッダー
名前, Type, 説明
accept string

Setting to application/vnd.github+json is recommended.

パス パラメーター
名前, Type, 説明
codespace_name string 必須

The name of the codespace.

"List machine types for a codespace" の HTTP 応答状態コード

状態コード説明
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

404

Resource not found

500

Internal Error

"List machine types for a codespace" のコード サンプル

要求の例

get/user/codespaces/{codespace_name}/machines
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/user/codespaces/CODESPACE_NAME/machines

Response

Status: 200
{ "total_count": 2, "machines": [ { "name": "standardLinux", "display_name": "4 cores, 16 GB RAM, 64 GB storage", "operating_system": "linux", "storage_in_bytes": 68719476736, "memory_in_bytes": 17179869184, "cpus": 4 }, { "name": "premiumLinux", "display_name": "8 cores, 32 GB RAM, 64 GB storage", "operating_system": "linux", "storage_in_bytes": 68719476736, "memory_in_bytes": 34359738368, "cpus": 8 } ] }