Skip to main content
ドキュメントへの更新が頻繁に発行されており、このページの翻訳はまだ行われている場合があります。 最新の情報については、「英語のドキュメント」を参照してください。
REST API はバージョン管理になりました。 詳細については、「API のバージョン管理について」を参照してください。

Codespaces マシン

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

Codespaces マシンについて

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

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

List available machine types for a repository

に対応 GitHub Apps

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

You must authenticate using an access token with the codespace scope to use this endpoint.

GitHub Apps must have write access to the codespaces_metadata repository permission to use this endpoint.

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

ヘッダー
名前, Type, 説明
acceptstring

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

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

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

repostring必須

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

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

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

client_ipstring

IP for location auto-detection when proxying a request

"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, 8 GB RAM, 64 GB storage", "operating_system": "linux", "storage_in_bytes": 68719476736, "memory_in_bytes": 8589934592, "cpus": 4 }, { "name": "premiumLinux", "display_name": "8 cores, 16 GB RAM, 64 GB storage", "operating_system": "linux", "storage_in_bytes": 68719476736, "memory_in_bytes": 17179869184, "cpus": 8 } ] }

List machine types for a codespace

List the machine types a codespace can transition to use.

You must authenticate using an access token with the codespace scope to use this endpoint.

GitHub Apps must have read access to the codespaces_metadata repository permission to use this endpoint.

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

ヘッダー
名前, Type, 説明
acceptstring

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

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

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, 8 GB RAM, 64 GB storage", "operating_system": "linux", "storage_in_bytes": 68719476736, "memory_in_bytes": 8589934592, "cpus": 4 }, { "name": "premiumLinux", "display_name": "8 cores, 16 GB RAM, 64 GB storage", "operating_system": "linux", "storage_in_bytes": 68719476736, "memory_in_bytes": 17179869184, "cpus": 8 } ] }