Skip to main content

此版本的 GitHub Enterprise Server 已于以下日期停止服务 2024-09-24. 即使针对重大安全问题,也不会发布补丁。 为了获得更好的性能、更高的安全性和新功能,请升级到最新版本的 GitHub Enterprise。 如需升级帮助,请联系 GitHub Enterprise 支持

REST API 现已经过版本控制。 有关详细信息,请参阅“关于 API 版本控制”。

SCIM 的 REST API 端点

使用 REST API 通过 SCIM 自动创建用户和团队成员身份。

关于 SCIM

Note

GitHub Enterprise Server 的 SCIM 目前为专用 beta 版本,可能会随时更改。 要访问 beta 版本,请通过 GitHub 的销售团队 联系帐户管理员。 可以在 GitHub Community 讨论中提供反馈。

Warning

beta 版本仅供测试和反馈,不提供支持。 GitHub 建议使用暂存实例进行测试。 有关详细信息,请参阅“设置暂存实例”。

这些终结点仅支持使用 personal access token (classic) 进行身份验证。 有关详细信息,请参阅“管理个人访问令牌”。

GitHub Enterprise Server 提供终结点供启用 SCIM 的标识提供者 (IdP) 使用。 IdP 上的集成可以使用 REST API 在使用 SAML 单一登录 (SSO) 进行身份验证的 GitHub Enterprise Server 实例上自动预配、管理或取消预配用户帐户。 请参阅“在 GitHub Enterprise Server 上使用 SCIM 配置用户预配”。

这些终结点基于 SCIM 2.0。 有关详细信息,请参阅 IdP 的文档,或者参阅 IETF 网站上的规范

根 URL

IdP 可以使用以下根 URL 与 GitHub Enterprise Server 实例在此类别中的终结点进行通信。

http(s)://HOSTNAME/api/v3/scim/v2/

不要在下面的终结点文档中包含 URL 的 enterprises/{enterprise}/ 部分。 此部分路径不适用于 GitHub Enterprise Server。 将来,本文档将显示 GitHub Enterprise Server 的正确 URL。

此类别中的终结点区分大小写。 例如,Users 终结点中的第一个字母必须大写。

GET /scim/v2/Users/{scim_user_id}

身份验证

IdP 上的 SCIM 集成代表 GitHub Enterprise Server 实例的一个企业所有者执行操作。 有关详细信息,请参阅“企业中的角色”。

要对 API 请求进行身份验证,在 IdP 上配置 SCIM 的用户必须使用 admin:enterprise 范围的 personal access token (classic),IdP 必须在请求的 Authorization 标头中提供该信息。 有关 personal access tokens (classic) 的详细信息,请参阅“管理个人访问令牌”。

注意:企业所有者必须生成并使用 personal access token (classic) 对此类别中终结点的请求进行身份验证。 目前不支持 Fine-grained personal access token 和 GitHub 应用调用方。

SAML 和 SCIM 数据的映射

GitHub Enterprise Server 实例将每个通过 SAML SSO 成功进行身份验证的用户链接到 SCIM 标识。 若要成功链接标识,SAML IdP 和 SCIM 集成必须为每个用户使用匹配的 SAML NameID 和 SCIM userName 值。

注意:**** 如果 GitHub Enterprise Server 将 Entra ID 用作 SAML IdP,GitHub Enterprise Server 首先会检查 SCIM externalId 声明和 SAML http://schemas.microsoft.com/identity/claims/objectidentifier 声明是否与用户相匹配,而不是使用 NameIDuserName

支持的 SCIM 用户属性

此类别中的 User 终结点支持在请求参数中使用以下属性。

名称Type说明
displayNameString用户的人类可读名称。
name.formattedString用户的全名,包括所有中间名、称谓和后缀,经过格式化以便显示。
name.givenNameString用户的名字。
name.familyNameString用户的姓氏。
userNameString由 IdP 生成的用户的用户名。 使用前经过规范化处理。
emailsArray用户的电子邮件列表。
rolesArray用户角色的列表。
externalIdString此标识符由 IdP 提供程序生成。 可以在 IdP 上查找用户的 externalId,也可以使用列出 SCIM 预配的标识终结点并筛选其他已知属性,例如 GitHub Enterprise Server 实例上用户的用户名或电子邮件地址。
idString实例的 SCIM 终结点生成的标识符。
active布尔指示标识处于活动状态 (true) 还是应暂停 (false)。

List provisioned SCIM groups for an enterprise

Note

The SCIM API endpoints for enterprise accounts are currently in private beta and are subject to change.

Lists provisioned SCIM groups in an enterprise.

You can improve query search time by using the excludedAttributes query parameter with a value of members to exclude members from the response.

“List provisioned SCIM groups for an enterprise”的细粒度访问令牌

此端点支持以下精细令牌类型:

精细令牌必须具有以下权限集:

  • "Enterprise administration" business permissions (write)

“List provisioned SCIM groups for an enterprise”的参数

标头
名称, 类型, 说明
accept string

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

路径参数
名称, 类型, 说明
enterprise string 必须

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

查询参数
名称, 类型, 说明
filter string

If specified, only results that match the specified filter will be returned. Multiple filters are not supported. Possible filters are externalId, id, and displayName. For example, ?filter="externalId eq '9138790-10932-109120392-12321'".

excludedAttributes string

Excludes the specified attribute from being returned in the results. Using this parameter can speed up response time.

startIndex integer

Used for pagination: the starting index of the first result to return when paginating through values.

默认: 1

count integer

Used for pagination: the number of results to return per page.

默认: 30

“List provisioned SCIM groups for an enterprise”的 HTTP 响应状态代码

状态代码说明
200

Success, either groups were found or not found

400

Bad request

401

Authorization failure

403

Permission denied

429

Too many requests

500

Internal server error

“List provisioned SCIM groups for an enterprise”的示例代码

请求示例

get/scim/v2/enterprises/{enterprise}/Groups
curl -L \ -H "Accept: application/scim+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Groups

Success, either groups were found or not found

Status: 200
{ "schemas": [ "urn:ietf:params:scim:api:messages:2.0:ListResponse" ], "totalResults": 1, "Resources": [ { "schemas": [ "urn:ietf:params:scim:schemas:core:2.0:Group" ], "externalId": "8aa1a0c0-c4c3-4bc0-b4a5-2ef676900159", "id": "927fa2c08dcb4a7fae9e", "displayName": "Engineering", "members": [ { "value": "879db59-3bdf-4490-ad68-ab880a2694745", "$+ref": "https://api.github.localhost/scim/v2/Users/879db59-3bdf-4490-ad68-ab880a2694745", "displayName": "User 1" }, { "value": "0db508eb-91e2-46e4-809c-30dcbda0c685", "$+ref": "https://api.github.localhost/scim/v2/Users/0db508eb-91e2-46e4-809c-30dcbda0c685", "displayName": "User 2" } ], "meta": { "resourceType": "Group", "created": "2012-03-27T19:59:26.000Z", "lastModified": "2018-03-27T19:59:26.000Z", "location": "https://api.github.localhost/scim/v2/Groups/927fa2c08dcb4a7fae9e" } } ], "startIndex": 1, "itemsPerPage": 20 }

Provision a SCIM enterprise group

Note

The SCIM API endpoints for enterprise accounts are currently in private beta and are subject to change.

Creates a SCIM group for an enterprise.

If members are included as part of the group provisioning payload, they will be created as external group members. It is up to a provider to store a mapping between the externalId and id of each user.

“Provision a SCIM enterprise group”的细粒度访问令牌

此端点支持以下精细令牌类型:

精细令牌必须具有以下权限集:

  • "Enterprise administration" business permissions (write)

“Provision a SCIM enterprise group”的参数

标头
名称, 类型, 说明
accept string

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

路径参数
名称, 类型, 说明
enterprise string 必须

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

正文参数
名称, 类型, 说明
schemas array of strings 必须

The URIs that are used to indicate the namespaces of the SCIM schemas. Supported values are: urn:ietf:params:scim:schemas:core:2.0:Group

externalId string 必须

A unique identifier for the resource as defined by the provisioning client.

displayName string 必须

A human-readable name for a security group.

members array of objects 必须

The group members.

名称, 类型, 说明
value string 必须

The local unique identifier for the member

displayName string 必须

The display name associated with the member

“Provision a SCIM enterprise group”的 HTTP 响应状态代码

状态代码说明
201

Group has been created

400

Bad request

401

Authorization failure

403

Permission denied

409

Duplicate record detected

429

Too many requests

500

Internal server error

“Provision a SCIM enterprise group”的示例代码

请求示例

post/scim/v2/enterprises/{enterprise}/Groups
curl -L \ -X POST \ -H "Accept: application/scim+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Groups \ -d '{"schemas":["urn:ietf:params:scim:schemas:core:2.0:Group"],"externalId":"8aa1a0c0-c4c3-4bc0-b4a5-2ef676900159","displayName":"Engineering"}'

Group has been created

Status: 201
{ "schemas": [ "urn:ietf:params:scim:schemas:core:2.0:Group" ], "id": "abcd27f8-a9aa-11ea-8221-f59b2be9cccc", "externalId": "8aa1a0c0-c4c3-4bc0-b4a5-2ef676900159", "displayName": "Engineering", "members": [ { "value": "879db59-3bdf-4490-ad68-ab880a2694745", "$+ref": "https://api.github.localhost/scim/v2/Users/879db59-3bdf-4490-ad68-ab880a2694745", "displayName": "User 1" }, { "value": "0db508eb-91e2-46e4-809c-30dcbda0c685", "$+ref": "https://api.github.localhost/scim/v2/Users/0db508eb-91e2-46e4-809c-30dcbda0c685", "displayName": "User 2" } ], "meta": { "resourceType": "Group", "created": "2012-03-27T19:59:26.000Z", "lastModified": "2018-03-27T19:59:26.000Z", "location": "https://api.github.localhost/scim/v2/Groups/927fa2c08dcb4a7fae9e" } }

Get SCIM provisioning information for an enterprise group

Note

The SCIM API endpoints for enterprise accounts are currently in private beta and are subject to change.

Gets information about a SCIM group.

“Get SCIM provisioning information for an enterprise group”的细粒度访问令牌

此端点支持以下精细令牌类型:

精细令牌必须具有以下权限集:

  • "Enterprise administration" business permissions (write)

“Get SCIM provisioning information for an enterprise group”的参数

标头
名称, 类型, 说明
accept string

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

路径参数
名称, 类型, 说明
scim_group_id string 必须

A unique identifier of the SCIM group.

enterprise string 必须

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

查询参数
名称, 类型, 说明
excludedAttributes string

Excludes the specified attribute from being returned in the results. Using this parameter can speed up response time.

“Get SCIM provisioning information for an enterprise group”的 HTTP 响应状态代码

状态代码说明
200

Success, a group was found

400

Bad request

401

Authorization failure

403

Permission denied

404

Resource not found

429

Too many requests

500

Internal server error

“Get SCIM provisioning information for an enterprise group”的示例代码

请求示例

get/scim/v2/enterprises/{enterprise}/Groups/{scim_group_id}
curl -L \ -H "Accept: application/scim+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Groups/SCIM_GROUP_ID

Success, a group was found

Status: 200
{ "schemas": [ "urn:ietf:params:scim:schemas:core:2.0:Group" ], "id": "abcd27f8-a9aa-11ea-8221-f59b2be9cccc", "externalId": "8aa1a0c0-c4c3-4bc0-b4a5-2ef676900159", "displayName": "Engineering", "members": [ { "value": "879db59-3bdf-4490-ad68-ab880a2694745", "$+ref": "https://api.github.localhost/scim/v2/Users/879db59-3bdf-4490-ad68-ab880a2694745", "displayName": "User 1" }, { "value": "0db508eb-91e2-46e4-809c-30dcbda0c685", "$+ref": "https://api.github.localhost/scim/v2/Users/0db508eb-91e2-46e4-809c-30dcbda0c685", "displayName": "User 2" } ], "meta": { "resourceType": "Group", "created": "2012-03-27T19:59:26.000Z", "lastModified": "2018-03-27T19:59:26.000Z", "location": "https://api.github.localhost/scim/v2/Groups/927fa2c08dcb4a7fae9e" } }

Set SCIM information for a provisioned enterprise group

Note

The SCIM API endpoints for enterprise accounts are currently in private beta and are subject to change.

Replaces an existing provisioned group’s information.

You must provide all the information required for the group as if you were provisioning it for the first time. Any existing group information that you don't provide will be removed, including group membership. If you want to only update a specific attribute, use the Update an attribute for a SCIM enterprise group endpoint instead.

“Set SCIM information for a provisioned enterprise group”的细粒度访问令牌

此端点支持以下精细令牌类型:

精细令牌必须具有以下权限集:

  • "Enterprise administration" business permissions (write)

“Set SCIM information for a provisioned enterprise group”的参数

标头
名称, 类型, 说明
accept string

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

路径参数
名称, 类型, 说明
scim_group_id string 必须

A unique identifier of the SCIM group.

enterprise string 必须

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

正文参数
名称, 类型, 说明
schemas array of strings 必须

The URIs that are used to indicate the namespaces of the SCIM schemas. Supported values are: urn:ietf:params:scim:schemas:core:2.0:Group

externalId string 必须

A unique identifier for the resource as defined by the provisioning client.

displayName string 必须

A human-readable name for a security group.

members array of objects 必须

The group members.

名称, 类型, 说明
value string 必须

The local unique identifier for the member

displayName string 必须

The display name associated with the member

“Set SCIM information for a provisioned enterprise group”的 HTTP 响应状态代码

状态代码说明
200

Group was updated

400

Bad request

401

Authorization failure

403

Permission denied

404

Resource not found

409

Duplicate record detected

429

Too many requests

500

Internal server error

“Set SCIM information for a provisioned enterprise group”的示例代码

请求示例

put/scim/v2/enterprises/{enterprise}/Groups/{scim_group_id}
curl -L \ -X PUT \ -H "Accept: application/scim+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Groups/SCIM_GROUP_ID \ -d '{"schemas":["urn:ietf:params:scim:schemas:core:2.0:Group"],"externalId":"8aa1a0c0-c4c3-4bc0-b4a5-2ef676900159","displayName":"Engineering"}'

Group was updated

Status: 200
{ "schemas": [ "urn:ietf:params:scim:schemas:core:2.0:Group" ], "id": "abcd27f8-a9aa-11ea-8221-f59b2be9cccc", "externalId": "8aa1a0c0-c4c3-4bc0-b4a5-2ef676900159", "displayName": "Engineering", "members": [ { "value": "879db59-3bdf-4490-ad68-ab880a2694745", "$+ref": "https://api.github.localhost/scim/v2/Users/879db59-3bdf-4490-ad68-ab880a2694745", "displayName": "User 1" }, { "value": "0db508eb-91e2-46e4-809c-30dcbda0c685", "$+ref": "https://api.github.localhost/scim/v2/Users/0db508eb-91e2-46e4-809c-30dcbda0c685", "displayName": "User 2" } ], "meta": { "resourceType": "Group", "created": "2012-03-27T19:59:26.000Z", "lastModified": "2018-03-27T19:59:26.000Z", "location": "https://api.github.localhost/scim/v2/Groups/927fa2c08dcb4a7fae9e" } }

Update an attribute for a SCIM enterprise group

Note

The SCIM API endpoints for enterprise accounts are currently in private beta and are subject to change.

Update a provisioned group’s individual attributes.

To change a group’s values, you must provide a specific Operations JSON format that contains at least one of the add, remove, or replace operations. For examples and more information on the SCIM operations format, see the SCIM specification. Update can also be used to add group memberships.

Group memberships can be sent one at a time or in batches for faster performance. Note: The memberships are referenced through a local user id, and the user will need to be created before they are referenced here.

“Update an attribute for a SCIM enterprise group”的细粒度访问令牌

此端点支持以下精细令牌类型:

精细令牌必须具有以下权限集:

  • "Enterprise administration" business permissions (write)

“Update an attribute for a SCIM enterprise group”的参数

标头
名称, 类型, 说明
accept string

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

路径参数
名称, 类型, 说明
scim_group_id string 必须

A unique identifier of the SCIM group.

enterprise string 必须

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

正文参数
名称, 类型, 说明
Operations array of objects 必须

patch operations list

名称, 类型, 说明
op string 必须

可以是以下选项之一: add, replace, remove

path string
value string

Corresponding 'value' of that field specified by 'path'

schemas array of strings 必须

undefinedSupported values are: urn:ietf:params:scim:api:messages:2.0:PatchOp

“Update an attribute for a SCIM enterprise group”的 HTTP 响应状态代码

状态代码说明
200

Success, group was updated

204

No Content

400

Bad request

401

Authorization failure

403

Permission denied

404

Resource not found

409

Duplicate record detected

429

Too many requests

500

Internal server error

“Update an attribute for a SCIM enterprise group”的示例代码

请求示例

patch/scim/v2/enterprises/{enterprise}/Groups/{scim_group_id}
curl -L \ -X PATCH \ -H "Accept: application/scim+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Groups/SCIM_GROUP_ID \ -d '{"schemas":["urn:ietf:params:scim:api:messages:2.0:PatchOp"],"Operations":[{"op":"replace","path":"displayName","value":"Employees"}]}'

Success, group was updated

Status: 200
{ "schemas": [ "urn:ietf:params:scim:schemas:core:2.0:Group" ], "id": "abcd27f8-a9aa-11ea-8221-f59b2be9cccc", "externalId": "8aa1a0c0-c4c3-4bc0-b4a5-2ef676900159", "displayName": "Engineering", "members": [ { "value": "879db59-3bdf-4490-ad68-ab880a2694745", "$+ref": "https://api.github.localhost/scim/v2/Users/879db59-3bdf-4490-ad68-ab880a2694745", "displayName": "User 1" }, { "value": "0db508eb-91e2-46e4-809c-30dcbda0c685", "$+ref": "https://api.github.localhost/scim/v2/Users/0db508eb-91e2-46e4-809c-30dcbda0c685", "displayName": "User 2" } ], "meta": { "resourceType": "Group", "created": "2012-03-27T19:59:26.000Z", "lastModified": "2018-03-27T19:59:26.000Z", "location": "https://api.github.localhost/scim/v2/Groups/927fa2c08dcb4a7fae9e" } }

Delete a SCIM group from an enterprise

Note

The SCIM API endpoints for enterprise accounts are currently in private beta and are subject to change.

Deletes a SCIM group from an enterprise.

“Delete a SCIM group from an enterprise”的细粒度访问令牌

此端点支持以下精细令牌类型:

精细令牌必须具有以下权限集:

  • "Enterprise administration" business permissions (write)

“Delete a SCIM group from an enterprise”的参数

标头
名称, 类型, 说明
accept string

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

路径参数
名称, 类型, 说明
scim_group_id string 必须

A unique identifier of the SCIM group.

enterprise string 必须

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

“Delete a SCIM group from an enterprise”的 HTTP 响应状态代码

状态代码说明
204

Group was deleted, no content

400

Bad request

401

Authorization failure

403

Permission denied

404

Resource not found

429

Too many requests

500

Internal server error

“Delete a SCIM group from an enterprise”的示例代码

请求示例

delete/scim/v2/enterprises/{enterprise}/Groups/{scim_group_id}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Groups/SCIM_GROUP_ID

Group was deleted, no content

Status: 204

List SCIM provisioned identities for an enterprise

Note

The SCIM API endpoints for enterprise accounts are currently in private beta and are subject to change.

Lists provisioned SCIM enterprise members.

When a user with a SCIM-provisioned external identity is removed from an enterprise through a patch with active flag set to false, the account's metadata is preserved to allow the user to re-join the enterprise in the future. However, the user's account will be suspended and the user will not be able to sign-in. In order to permanently suspend the users account with no ability to re-join the enterprise in the future, use the delete request. Users that were not permanently deleted will be visible in the returned results.

“List SCIM provisioned identities for an enterprise”的细粒度访问令牌

此端点支持以下精细令牌类型:

精细令牌必须具有以下权限集:

  • "Enterprise administration" business permissions (write)

“List SCIM provisioned identities for an enterprise”的参数

标头
名称, 类型, 说明
accept string

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

路径参数
名称, 类型, 说明
enterprise string 必须

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

查询参数
名称, 类型, 说明
filter string

If specified, only results that match the specified filter will be returned. Multiple filters are not supported. Possible filters are userName, externalId, id, and displayName. For example, ?filter="externalId eq '9138790-10932-109120392-12321'".

startIndex integer

Used for pagination: the starting index of the first result to return when paginating through values.

默认: 1

count integer

Used for pagination: the number of results to return per page.

默认: 30

“List SCIM provisioned identities for an enterprise”的 HTTP 响应状态代码

状态代码说明
200

Success, either users were found or not found

400

Bad request

401

Authorization failure

403

Permission denied

429

Too many requests

500

Internal server error

“List SCIM provisioned identities for an enterprise”的示例代码

请求示例

get/scim/v2/enterprises/{enterprise}/Users
curl -L \ -H "Accept: application/scim+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Users

Success, either users were found or not found

Status: 200
{ "schemas": [ "urn:ietf:params:scim:api:messages:2.0:ListResponse" ], "totalResults": 1, "Resources": [ { "schemas": [ "urn:ietf:params:scim:schemas:core:2.0:User" ], "externalId": "E012345", "id": "7fce0092-d52e-4f76-b727-3955bd72c939", "active": true, "userName": "E012345", "name": { "formatted": "Ms. Mona Lisa Octocat", "familyName": "Octocat", "givenName": "Mona", "middleName": "Lisa" }, "displayName": "Mona Lisa", "emails": [ { "value": "mlisa@example.com", "type": "work", "primary": true } ], "roles": [ { "value": "User", "primary": false } ] } ], "startIndex": 1, "itemsPerPage": 20 }

Provision a SCIM enterprise user

Note

The SCIM API endpoints for enterprise accounts are currently in private beta and are subject to change.

Creates an external identity for a new SCIM enterprise user.

SCIM does not authenticate users, it only provisions them. The authentication of users is done by SAML. However, when SCIM is enabled, all users need to be provisioned through SCIM before a user can sign in through SAML. The matching of a user to a SCIM provisioned user is done when the SAML assertion is consumed. The user will be matched on SAML response NameID to SCIM userName.

When converting existing enterprise to use SCIM, the user handle (userName) from the SCIM payload will be used to match the provisioned user to an already existing user in the enterprise. Since the new identity record is created for newly provisioned users the matching for those records is done using a user's handle. Currently the matching will be performed to all of the users no matter if they were SAML JIT provisioned or created as local users.

“Provision a SCIM enterprise user”的细粒度访问令牌

此端点支持以下精细令牌类型:

精细令牌必须具有以下权限集:

  • "Enterprise administration" business permissions (write)

“Provision a SCIM enterprise user”的参数

标头
名称, 类型, 说明
accept string

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

路径参数
名称, 类型, 说明
enterprise string 必须

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

正文参数
名称, 类型, 说明
schemas array of strings 必须

The URIs that are used to indicate the namespaces of the SCIM schemas. Supported values are: urn:ietf:params:scim:schemas:core:2.0:User

externalId string 必须

A unique identifier for the resource as defined by the provisioning client.

active boolean 必须

Whether the user active in the IdP.

userName string 必须

The username for the user.

name object
名称, 类型, 说明
formatted string

The full name, including all middle names, titles, and suffixes as appropriate, formatted for display.

familyName string 必须

The family name of the user.

givenName string 必须

The given name of the user.

middleName string

The middle name(s) of the user.

displayName string 必须

A human-readable name for the user.

emails array of objects 必须

The emails for the user.

名称, 类型, 说明
value string 必须

The email address.

type string 必须

The type of email address.

primary boolean 必须

Whether this email address is the primary address.

roles array of objects

The roles assigned to the user.

名称, 类型, 说明
display string
type string
value string 必须

The role value representing a user role in GitHub.

可以是以下选项之一: user, 27d9891d-2c17-4f45-a262-781a0e55c80a, guest_collaborator, 1ebc4a02-e56c-43a6-92a5-02ee09b90824, enterprise_owner, 981df190-8801-4618-a08a-d91f6206c954, ba4987ab-a1c3-412a-b58c-360fc407cb10, billing_manager, 0e338b8c-cc7f-498a-928d-ea3470d7e7e3, e6be2762-e4ad-4108-b72d-1bbe884a0f91

primary boolean

Is the role a primary role for the user.

“Provision a SCIM enterprise user”的 HTTP 响应状态代码

状态代码说明
201

User has been created

400

Bad request

401

Authorization failure

403

Permission denied

409

Duplicate record detected

429

Too many requests

500

Internal server error

“Provision a SCIM enterprise user”的示例代码

请求示例

post/scim/v2/enterprises/{enterprise}/Users
curl -L \ -X POST \ -H "Accept: application/scim+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Users \ -d '{"schemas":["urn:ietf:params:scim:schemas:core:2.0:User"],"externalId":"E012345","active":true,"userName":"E012345","name":{"formatted":"Ms. Mona Lisa Octocat","familyName":"Octocat","givenName":"Mona","middleName":"Lisa"},"displayName":"Mona Lisa","emails":[{"value":"mlisa@example.com","type":"work","primary":true}],"roles":[{"value":"User","primary":false}]}'

User has been created

Status: 201
{ "schemas": [ "urn:ietf:params:scim:schemas:core:2.0:User" ], "id": "7fce0092-d52e-4f76-b727-3955bd72c939", "externalId": "E012345", "active": true, "userName": "E012345", "name": { "formatted": "Ms. Mona Lisa Octocat", "familyName": "Octocat", "givenName": "Mona", "middleName": "Lisa" }, "displayName": "Mona Lisa", "emails": [ { "value": "mlisa@example.com", "type": "work", "primary": true } ], "roles": [ { "value": "User", "primary": false } ], "meta": { "resourceType": "User", "created": "2012-03-27T19:59:26.000Z", "lastModified": "2018-03-27T19:59:26.000Z", "location": "https://api.github.localhost/scim/v2/Users/7fce0092-d52e-4f76-b727-3955bd72c939" } }

Get SCIM provisioning information for an enterprise user

Note

The SCIM API endpoints for enterprise accounts are currently in private beta and are subject to change.

Gets information about a SCIM user.

“Get SCIM provisioning information for an enterprise user”的细粒度访问令牌

此端点支持以下精细令牌类型:

精细令牌必须具有以下权限集:

  • "Enterprise administration" business permissions (write)

“Get SCIM provisioning information for an enterprise user”的参数

标头
名称, 类型, 说明
accept string

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

路径参数
名称, 类型, 说明
scim_user_id string 必须

The unique identifier of the SCIM user.

enterprise string 必须

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

“Get SCIM provisioning information for an enterprise user”的 HTTP 响应状态代码

状态代码说明
200

Success, a user was found

400

Bad request

401

Authorization failure

403

Permission denied

404

Resource not found

429

Too many requests

500

Internal server error

“Get SCIM provisioning information for an enterprise user”的示例代码

请求示例

get/scim/v2/enterprises/{enterprise}/Users/{scim_user_id}
curl -L \ -H "Accept: application/scim+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Users/SCIM_USER_ID

Success, a user was found

Status: 200
{ "schemas": [ "urn:ietf:params:scim:schemas:core:2.0:User" ], "id": "7fce0092-d52e-4f76-b727-3955bd72c939", "externalId": "E012345", "active": true, "userName": "E012345", "name": { "formatted": "Ms. Mona Lisa Octocat", "familyName": "Octocat", "givenName": "Mona", "middleName": "Lisa" }, "displayName": "Mona Lisa", "emails": [ { "value": "mlisa@example.com", "type": "work", "primary": true } ], "roles": [ { "value": "User", "primary": false } ], "meta": { "resourceType": "User", "created": "2012-03-27T19:59:26.000Z", "lastModified": "2018-03-27T19:59:26.000Z", "location": "https://api.github.localhost/scim/v2/Users/7fce0092-d52e-4f76-b727-3955bd72c939" } }

Set SCIM information for a provisioned enterprise user

Note

The SCIM API endpoints for enterprise accounts are currently in private beta and are subject to change.

Replaces an existing provisioned user's information.

You must provide all the information required for the user as if you were provisioning them for the first time. Any existing user information that you don't provide will be removed. If you want to only update a specific attribute, use the Update an attribute for a SCIM user endpoint instead.

Warning

Setting active: false will suspend a user and obfuscate the user handle and user email. Since the implementation is a generic SCIM implementation and does not differentiate yet between different IdP providers, for Okta, the user GDPR data will not be purged and the credentials will not be removed.

“Set SCIM information for a provisioned enterprise user”的细粒度访问令牌

此端点支持以下精细令牌类型:

精细令牌必须具有以下权限集:

  • "Enterprise administration" business permissions (write)

“Set SCIM information for a provisioned enterprise user”的参数

标头
名称, 类型, 说明
accept string

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

路径参数
名称, 类型, 说明
scim_user_id string 必须

The unique identifier of the SCIM user.

enterprise string 必须

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

正文参数
名称, 类型, 说明
schemas array of strings 必须

The URIs that are used to indicate the namespaces of the SCIM schemas. Supported values are: urn:ietf:params:scim:schemas:core:2.0:User

externalId string 必须

A unique identifier for the resource as defined by the provisioning client.

active boolean 必须

Whether the user active in the IdP.

userName string 必须

The username for the user.

name object
名称, 类型, 说明
formatted string

The full name, including all middle names, titles, and suffixes as appropriate, formatted for display.

familyName string 必须

The family name of the user.

givenName string 必须

The given name of the user.

middleName string

The middle name(s) of the user.

displayName string 必须

A human-readable name for the user.

emails array of objects 必须

The emails for the user.

名称, 类型, 说明
value string 必须

The email address.

type string 必须

The type of email address.

primary boolean 必须

Whether this email address is the primary address.

roles array of objects

The roles assigned to the user.

名称, 类型, 说明
display string
type string
value string 必须

The role value representing a user role in GitHub.

可以是以下选项之一: user, 27d9891d-2c17-4f45-a262-781a0e55c80a, guest_collaborator, 1ebc4a02-e56c-43a6-92a5-02ee09b90824, enterprise_owner, 981df190-8801-4618-a08a-d91f6206c954, ba4987ab-a1c3-412a-b58c-360fc407cb10, billing_manager, 0e338b8c-cc7f-498a-928d-ea3470d7e7e3, e6be2762-e4ad-4108-b72d-1bbe884a0f91

primary boolean

Is the role a primary role for the user.

“Set SCIM information for a provisioned enterprise user”的 HTTP 响应状态代码

状态代码说明
200

User was updated

400

Bad request

401

Authorization failure

403

Permission denied

404

Resource not found

409

Duplicate record detected

429

Too many requests

500

Internal server error

“Set SCIM information for a provisioned enterprise user”的示例代码

请求示例

put/scim/v2/enterprises/{enterprise}/Users/{scim_user_id}
curl -L \ -X PUT \ -H "Accept: application/scim+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Users/SCIM_USER_ID \ -d '{"schemas":["urn:ietf:params:scim:schemas:core:2.0:User"],"externalId":"E012345","active":true,"userName":"E012345","name":{"formatted":"Ms. Mona Lisa Octocat","familyName":"Octocat","givenName":"Mona","middleName":"Lisa"},"displayName":"Mona Lisa","emails":[{"value":"mlisa@example.com","type":"work","primary":true}],"roles":[{"value":"User","primary":false}]}'

User was updated

Status: 200
{ "schemas": [ "urn:ietf:params:scim:schemas:core:2.0:User" ], "id": "7fce0092-d52e-4f76-b727-3955bd72c939", "externalId": "E012345", "active": true, "userName": "E012345", "name": { "formatted": "Ms. Mona Lisa Octocat", "familyName": "Octocat", "givenName": "Mona", "middleName": "Lisa" }, "displayName": "Mona Lisa", "emails": [ { "value": "mlisa@example.com", "type": "work", "primary": true } ], "roles": [ { "value": "User", "primary": false } ], "meta": { "resourceType": "User", "created": "2012-03-27T19:59:26.000Z", "lastModified": "2018-03-27T19:59:26.000Z", "location": "https://api.github.localhost/scim/v2/Users/7fce0092-d52e-4f76-b727-3955bd72c939" } }

Update an attribute for a SCIM enterprise user

Note

The SCIM API endpoints for enterprise accounts are currently in private beta and are subject to change.

Update a provisioned user's individual attributes.

To change a user's values, you must provide a specific Operations JSON format that contains at least one of the add, remove, or replace operations. For examples and more information on the SCIM operations format, see the SCIM specification.

Note

Complicated SCIM path selectors that include filters are not supported. For example, a path selector defined as "path": "emails[type eq \"work\"]" will not work.

Warning

Setting active: false will suspend a user and obfuscate the user handle and user email. Since the implementation is a generic SCIM implementation and does not differentiate yet between different IdP providers, for Okta, the user GDPR data will not be purged and the credentials will not be removed.

{
  "Operations":[{
    "op":"replace",
    "value":{
      "active":false
    }
  }]
}

“Update an attribute for a SCIM enterprise user”的细粒度访问令牌

此端点支持以下精细令牌类型:

精细令牌必须具有以下权限集:

  • "Enterprise administration" business permissions (write)

“Update an attribute for a SCIM enterprise user”的参数

标头
名称, 类型, 说明
accept string

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

路径参数
名称, 类型, 说明
scim_user_id string 必须

The unique identifier of the SCIM user.

enterprise string 必须

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

正文参数
名称, 类型, 说明
Operations array of objects 必须

patch operations list

名称, 类型, 说明
op string 必须

可以是以下选项之一: add, replace, remove

path string
value string

Corresponding 'value' of that field specified by 'path'

schemas array of strings 必须

undefinedSupported values are: urn:ietf:params:scim:api:messages:2.0:PatchOp

“Update an attribute for a SCIM enterprise user”的 HTTP 响应状态代码

状态代码说明
200

Success, user was updated

400

Bad request

401

Authorization failure

403

Permission denied

404

Resource not found

409

Duplicate record detected

429

Too many requests

500

Internal server error

“Update an attribute for a SCIM enterprise user”的示例代码

请求示例

patch/scim/v2/enterprises/{enterprise}/Users/{scim_user_id}
curl -L \ -X PATCH \ -H "Accept: application/scim+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Users/SCIM_USER_ID \ -d '{"schemas":["urn:ietf:params:scim:api:messages:2.0:PatchOp"],"Operations":[{"op":"replace","path":"emails[type eq '\''work'\''].value","value":"updatedEmail@microsoft.com"},{"op":"replace","path":"name.familyName","value":"updatedFamilyName"}]}'

Success, user was updated

Status: 200
{ "schemas": [ "urn:ietf:params:scim:schemas:core:2.0:User" ], "id": "7fce0092-d52e-4f76-b727-3955bd72c939", "externalId": "E012345", "active": true, "userName": "E012345", "name": { "formatted": "Ms. Mona Lisa Octocat", "familyName": "Octocat", "givenName": "Mona", "middleName": "Lisa" }, "displayName": "Mona Lisa", "emails": [ { "value": "mlisa@example.com", "type": "work", "primary": true } ], "roles": [ { "value": "User", "primary": false } ], "meta": { "resourceType": "User", "created": "2012-03-27T19:59:26.000Z", "lastModified": "2018-03-27T19:59:26.000Z", "location": "https://api.github.localhost/scim/v2/Users/7fce0092-d52e-4f76-b727-3955bd72c939" } }

Delete a SCIM user from an enterprise

Note

The SCIM API endpoints for enterprise accounts are currently in private beta and are subject to change.

Permanently suspends a SCIM user from an enterprise, removes all data for the user, obfuscates the login, email, and display name of the user, removes all external-identity SCIM attributes, and deletes the emails, avatar, PATs, SSH keys, OAuth authorizations credentials, GPG keys, and SAML mappings for the user. You will not be able to undo this action.

“Delete a SCIM user from an enterprise”的细粒度访问令牌

此端点支持以下精细令牌类型:

精细令牌必须具有以下权限集:

  • "Enterprise administration" business permissions (write)

“Delete a SCIM user from an enterprise”的参数

标头
名称, 类型, 说明
accept string

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

路径参数
名称, 类型, 说明
scim_user_id string 必须

The unique identifier of the SCIM user.

enterprise string 必须

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

“Delete a SCIM user from an enterprise”的 HTTP 响应状态代码

状态代码说明
204

User was deleted, no content

400

Bad request

401

Authorization failure

403

Permission denied

404

Resource not found

429

Too many requests

500

Internal server error

“Delete a SCIM user from an enterprise”的示例代码

请求示例

delete/scim/v2/enterprises/{enterprise}/Users/{scim_user_id}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/scim/v2/enterprises/ENTERPRISE/Users/SCIM_USER_ID

User was deleted, no content

Status: 204