> For the complete documentation index, see [llms.txt](https://docs.ggwp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ggwp.com/chinese-simplified/shen-fen-yu-fang-wen-guan-li-iam/api-wen-dang-scim/scim-ji-chu.md).

# SCIM 基础

### 概述

SCIM（跨域身份管理系统）定义了一种用于管理身份的标准化模式和协议。每个 SCIM 资源都包含一个 `schemas` 字段：

#### 示例

```json
{
  "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"]
}
```

### Schema URN

<table><thead><tr><th width="112">资源</th><th>URN</th></tr></thead><tbody><tr><td>用户</td><td><code>urn:ietf:params:scim:schemas:core:2.0:User</code></td></tr><tr><td>PatchOp</td><td><code>urn:ietf:params:scim:api:messages:2.0:PatchOp</code></td></tr><tr><td>错误</td><td><code>urn:ietf:params:scim:api:messages:2.0:Error</code></td></tr></tbody></table>

### 重要说明

* `schemas` 必须始终存在
* schemas 无效或缺失将导致 `400 错误请求`

### 常见属性

这些属性在 SCIM 请求和响应中经常使用：

<table><thead><tr><th width="128">属性</th><th width="113">类型</th><th>描述</th></tr></thead><tbody><tr><td>id</td><td>字符串</td><td>系统生成的唯一标识符</td></tr><tr><td>externalId</td><td>字符串</td><td>来自外部系统（IdP）的 ID</td></tr><tr><td>userName</td><td>字符串</td><td>唯一用户名</td></tr></tbody></table>

### 元属性

SCIM 响应包含元数据：

```json
{
  "meta": {
    "resourceType": "User",
    "created": "2025-01-01T00:00:00Z",
    "lastModified": "2025-01-01T00:00:00Z"
  }
}
```

### 错误格式

所有错误都遵循标准的 SCIM 格式：

```json
{
  "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"],
  "status": "400",
  "detail": "无效请求"
}
```

### 错误代码

<table><thead><tr><th width="112">状态</th><th>含义</th></tr></thead><tbody><tr><td>400</td><td>错误请求</td></tr><tr><td>401</td><td>未授权</td></tr><tr><td>404</td><td>资源未找到</td></tr><tr><td>500</td><td>内部服务器错误</td></tr></tbody></table>
