organizations
Creates, updates, deletes, gets or lists an organizations resource.
Overview
| Name | organizations |
| Type | Resource |
| Id | github.codespaces.organizations |
Fields
The following fields are returned by SELECT queries:
- get_codespaces_for_user_in_org
- list_in_organization
Response
| Name | Datatype | Description |
|---|---|---|
codespaces | array | |
total_count | integer |
Response
| Name | Datatype | Description |
|---|---|---|
codespaces | array | |
total_count | integer |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_codespaces_for_user_in_org | select | org, username | per_page, page | Lists the codespaces that a member of an organization has for repositories in that organization. OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint. |
list_in_organization | select | org | per_page, page | Lists the codespaces associated to a specified organization. OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint. |
set_codespaces_access | replace | org, visibility | Sets which users can access codespaces in an organization. This is synonymous with granting or revoking codespaces access permissions for users according to the visibility. OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint. | |
delete_from_organization | delete | org, username, codespace_name | Deletes a user's codespace. OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint. | |
delete_codespaces_access_users | delete | org | Codespaces for the specified users will no longer be billed to the organization. To use this endpoint, the access settings for the organization must be set to selected_members.For information on how to change this setting, see "Manage access control for organization codespaces." OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint. | |
set_codespaces_access_users | exec | org, selected_usernames | Codespaces for the specified users will be billed to the organization. To use this endpoint, the access settings for the organization must be set to selected_members.For information on how to change this setting, see "Manage access control for organization codespaces." OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint. | |
stop_in_organization | exec | org, username, codespace_name | Stops a user's codespace. OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
codespace_name | string | The name of the codespace. |
org | string | The organization name. The name is not case sensitive. |
username | string | The handle for the GitHub user account. |
page | integer | The page number of the results to fetch. For more information, see "Using pagination in the REST API." |
per_page | integer | The number of results per page (max 100). For more information, see "Using pagination in the REST API." |
SELECT examples
- get_codespaces_for_user_in_org
- list_in_organization
Lists the codespaces that a member of an organization has for repositories in that organization.
OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
SELECT
codespaces,
total_count
FROM github.codespaces.organizations
WHERE org = '{{ org }}' -- required
AND username = '{{ username }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
;
Lists the codespaces associated to a specified organization.
OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
SELECT
codespaces,
total_count
FROM github.codespaces.organizations
WHERE org = '{{ org }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
;
REPLACE examples
- set_codespaces_access
Sets which users can access codespaces in an organization. This is synonymous with granting or revoking codespaces access permissions for users according to the visibility.
OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
REPLACE github.codespaces.organizations
SET
visibility = '{{ visibility }}',
selected_usernames = '{{ selected_usernames }}'
WHERE
org = '{{ org }}' --required
AND visibility = '{{ visibility }}' --required;
DELETE examples
- delete_from_organization
- delete_codespaces_access_users
Deletes a user's codespace.
OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
DELETE FROM github.codespaces.organizations
WHERE org = '{{ org }}' --required
AND username = '{{ username }}' --required
AND codespace_name = '{{ codespace_name }}' --required
;
Codespaces for the specified users will no longer be billed to the organization.
To use this endpoint, the access settings for the organization must be set to selected_members.
For information on how to change this setting, see "Manage access control for organization codespaces."
OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
DELETE FROM github.codespaces.organizations
WHERE org = '{{ org }}' --required
;
Lifecycle Methods
- set_codespaces_access_users
- stop_in_organization
Codespaces for the specified users will be billed to the organization.
To use this endpoint, the access settings for the organization must be set to selected_members.
For information on how to change this setting, see "Manage access control for organization codespaces."
OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
EXEC github.codespaces.organizations.set_codespaces_access_users
@org='{{ org }}' --required
@@json=
'{
"selected_usernames": "{{ selected_usernames }}"
}'
;
Stops a user's codespace.
OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
EXEC github.codespaces.organizations.stop_in_organization
@org='{{ org }}' --required,
@username='{{ username }}' --required,
@codespace_name='{{ codespace_name }}' --required
;