Skip to main content
我们经常发布文档更新,此页面的翻译可能仍在进行中。 有关最新信息,请访问英语文档

我们最近移动了一些 REST API 文档。 如果找不到要查找的内容,可以尝试 操作 REST API 页面。

SCIM

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

关于 SCIM

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

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

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

这些终结点基于 SCIM 2.0。 有关详细信息,请参阅规范

根 URL

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

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

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

GET /scim/v2/Users/{scim_user_id}

身份验证

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

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

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

SAML 和 SCIM 数据的映射

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

支持的 SCIM 用户属性

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

名称类型说明
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

适用于 GitHub Apps

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”的参数

标头
名称, 类型, 说明
acceptstring

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

查询参数
名称, 类型, 说明
filterstring

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'".

excludedAttributesstring

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

startIndexinteger

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

默认: 1

countinteger

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/Groups
curl -L \ -H "Accept: application/scim+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/scim/v2/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

适用于 GitHub Apps

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”的参数

标头
名称, 类型, 说明
acceptstring

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

正文参数
名称, 类型, 说明
schemasarray of strings必选

The URIs that are used to indicate the namespaces of the SCIM schemas.

externalIdstring必选

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

displayNamestring必选

A human-readable name for a security group.

membersarray of objects必选

The group members.

名称, 类型, 说明
valuestring必选

The local unique identifier for the member

displayNamestring必选

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/Groups
curl -L \ -X POST \ -H "Accept: application/scim+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/scim/v2/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

适用于 GitHub Apps

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”的参数

标头
名称, 类型, 说明
acceptstring

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

路径参数
名称, 类型, 说明
scim_group_idstring必选

A unique identifier of the SCIM group.

查询参数
名称, 类型, 说明
excludedAttributesstring

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/Groups/{scim_group_id}
curl -L \ -H "Accept: application/scim+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/scim/v2/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

适用于 GitHub Apps

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”的参数

标头
名称, 类型, 说明
acceptstring

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

路径参数
名称, 类型, 说明
scim_group_idstring必选

A unique identifier of the SCIM group.

正文参数
名称, 类型, 说明
schemasarray of strings必选

The URIs that are used to indicate the namespaces of the SCIM schemas.

externalIdstring必选

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

displayNamestring必选

A human-readable name for a security group.

membersarray of objects必选

The group members.

名称, 类型, 说明
valuestring必选

The local unique identifier for the member

displayNamestring必选

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/Groups/{scim_group_id}
curl -L \ -X PUT \ -H "Accept: application/scim+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/scim/v2/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

适用于 GitHub Apps

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”的参数

标头
名称, 类型, 说明
acceptstring

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

路径参数
名称, 类型, 说明
scim_group_idstring必选

A unique identifier of the SCIM group.

正文参数
名称, 类型, 说明
Operationsarray of objects必选

patch operations list

名称, 类型, 说明
opstring必选

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

pathstring
valuestring

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

schemasarray of strings必选

“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/Groups/{scim_group_id}
curl -L \ -X PATCH \ -H "Accept: application/scim+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/scim/v2/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

适用于 GitHub Apps

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”的参数

标头
名称, 类型, 说明
acceptstring

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

路径参数
名称, 类型, 说明
scim_group_idstring必选

A unique identifier of the SCIM group.

“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/Groups/{scim_group_id}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/scim/v2/Groups/SCIM_GROUP_ID

Group was deleted, no content

Status: 204

List SCIM provisioned identities for an enterprise

适用于 GitHub Apps

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.

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

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

标头
名称, 类型, 说明
acceptstring

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

查询参数
名称, 类型, 说明
filterstring

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'".

excludedAttributesstring

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

startIndexinteger

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

默认: 1

countinteger

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/Users
curl -L \ -H "Accept: application/scim+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/scim/v2/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

适用于 GitHub Apps

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”的参数

标头
名称, 类型, 说明
acceptstring

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

正文参数
名称, 类型, 说明
schemasarray of strings必选

The URIs that are used to indicate the namespaces of the SCIM schemas.

externalIdstring必选

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

activeboolean必选

Whether the user active in the IdP.

userNamestring必选

The username for the user.

nameobject
名称, 类型, 说明
formattedstring

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

familyNamestring必选

The family name of the user.

givenNamestring必选

The given name of the user.

middleNamestring

The middle name(s) of the user.

displayNamestring必选

A human-readable name for the user.

emailsarray of objects必选

The emails for the user.

名称, 类型, 说明
valuestring必选

The email address.

typestring必选

The type of email address.

primaryboolean必选

Whether this email address is the primary address.

rolesarray of objects

The roles assigned to the user.

名称, 类型, 说明
displaystring
typestring
valuestring必选

The role value representing a user role in GitHub.

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

primaryboolean

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/Users
curl -L \ -X POST \ -H "Accept: application/scim+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/scim/v2/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

适用于 GitHub Apps

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”的参数

标头
名称, 类型, 说明
acceptstring

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

路径参数
名称, 类型, 说明
scim_user_idstring必选

The unique identifier of the SCIM user.

“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/Users/{scim_user_id}
curl -L \ -H "Accept: application/scim+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/scim/v2/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

适用于 GitHub Apps

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”的参数

标头
名称, 类型, 说明
acceptstring

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

路径参数
名称, 类型, 说明
scim_user_idstring必选

The unique identifier of the SCIM user.

正文参数
名称, 类型, 说明
schemasarray of strings必选

The URIs that are used to indicate the namespaces of the SCIM schemas.

externalIdstring必选

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

activeboolean必选

Whether the user active in the IdP.

userNamestring必选

The username for the user.

nameobject
名称, 类型, 说明
formattedstring

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

familyNamestring必选

The family name of the user.

givenNamestring必选

The given name of the user.

middleNamestring

The middle name(s) of the user.

displayNamestring必选

A human-readable name for the user.

emailsarray of objects必选

The emails for the user.

名称, 类型, 说明
valuestring必选

The email address.

typestring必选

The type of email address.

primaryboolean必选

Whether this email address is the primary address.

rolesarray of objects

The roles assigned to the user.

名称, 类型, 说明
displaystring
typestring
valuestring必选

The role value representing a user role in GitHub.

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

primaryboolean

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/Users/{scim_user_id}
curl -L \ -X PUT \ -H "Accept: application/scim+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/scim/v2/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

适用于 GitHub Apps

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”的参数

标头
名称, 类型, 说明
acceptstring

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

路径参数
名称, 类型, 说明
scim_user_idstring必选

The unique identifier of the SCIM user.

正文参数
名称, 类型, 说明
Operationsarray of objects必选

patch operations list

名称, 类型, 说明
opstring必选

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

pathstring
valuestring

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

schemasarray of strings必选

“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/Users/{scim_user_id}
curl -L \ -X PATCH \ -H "Accept: application/scim+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/scim/v2/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

适用于 GitHub Apps

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”的参数

标头
名称, 类型, 说明
acceptstring

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

路径参数
名称, 类型, 说明
scim_user_idstring必选

The unique identifier of the SCIM user.

“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/Users/{scim_user_id}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/scim/v2/Users/SCIM_USER_ID

User was deleted, no content

Status: 204