Create Organization
Permissions
The Identity Management API is authorized at the application level. Before calling the API, you need to set API permissions for different applications. For details, see API Permissions.
| Permission Code | Description |
|---|---|
| org_all | Read/Write permission for organization management APIs |
| all | Read/Write permission for all APIs |
Request Description
Request Headers
| Parameter Name | Chinese Name | Required | Type | Description |
|---|---|---|---|---|
| Authorization | Authorization | Yes | String | Format: Bearer {access_token} |
| Content-Type | Content Type | Yes | String | Fixed value: application/json; charset=utf-8 |
Request Example
json
{
"code": "TestOrg2",
"name": "Test Organization 2",
"parent_id": "",
"category": "department",
"sequence": 5,
"extension": {
"uid": "123"
}
}Request Parameters
| Parameter Name | Chinese Name | Required | Type | Description |
|---|---|---|---|---|
| code | Organization code | Yes | String | Organization code |
| name | Organization name | Yes | String | Organization name |
| parent_id | Parent node ID | No | String | Parent node ID |
| category | Organization type | No | String | Organization type code |
| sequence | Display sequence | No | int | Display sequence |
| extension | Extension attributes | No | Map | Extension attributes; extended attributes need to be defined in the enterprise |
Response Example
Success Example
HTTP/1.1 201 Created
json
{
"org_id": "20220412142914549-1E50-B49C521A4"
}Error Example
HTTP/1.1 400 Bad Request
json
{
"error_code": "ORG.0008",
"error_msg": "The parent organization does not exist"
}Response Parameters
| Parameter Name | Chinese Name | Type | Description |
|---|---|---|---|
| org_id | Created organization ID | String | Auto-generated by the system |
Error Codes
| Status Code | Error Code | Chinese Error Message | English Error Message | Resolution |
|---|---|---|---|---|
| 400 | ORG.0008 | 父级组织不存在 | The parent organization does not exist | Please check whether the parent organization exists |
| 400 | ORG.0011 | 组织类型不能为空 | Organization type cannot be empty | Please check whether the organization type in the request parameters is empty |
| 400 | ORG.0012 | 组织编码不能为空 | Organization code cannot be empty | Please check whether the organization code in the request parameters is empty |
| 400 | ORG.0013 | 组织名称不能为空 | Organization name cannot be empty | Please check whether the organization name in the request parameters is empty |
| 400 | ORG.0015 | 组织编码已存在 | Organization code already exists | The current organization code already exists; please change it to a value that does not exist |
| 400 | ORG.0016 | 组织名称已存在 | Organization name already exists | The current organization name already exists; please change it to a value that does not exist |
| 400 | ORG.0017 | 组织编码不符合校验规则 | Organization code does not meet verification rules | Please check whether the organization code field in the request parameters complies with the verification rules in 【Enterprise Center - User - Organization Attribute Definition】 |
| 400 | ORG.0018 | 组织名称不符合校验规则 | Organization name does not meet verification rules | Please check whether the organization name field in the request parameters complies with the verification rules in 【Enterprise Center - User - Organization Attribute Definition】 |
| 400 | ORG.0028 | 组织层级不能超过{0}层 | The organization level cannot exceed {0} level | Please check whether the organization level exceeds {0} levels |
| 400 | ORG.0030 | 上级组织不能为空 | The parent organization cannot be empty | Please check whether the parent organization in the request parameters is empty |
| 400 | ORG.0032 | 显示顺序不能为空 | Organization sequence number cannot be empty | Please check whether the display sequence in the request parameters is empty |
| 400 | ORG.0035 | 扩展属性[{0}]不能为空 | Extension attribute [{0}] cannot be empty | Please check whether the extension attribute [{0}] field in the request parameters is empty |
| 400 | ORG.0039 | 扩展属性[{0}]已存在 | Extension attribute [{0}] already exists | The value of extension attribute [{0}] already exists; please change it to a value that does not exist |
| 400 | ORG.0040 | 组织全名不符合校验规则 | Organization full name does not meet verification rules | Please check whether the organization full name field in the request parameters complies with the verification rules in 【Enterprise Center - User - Organization Attribute Definition】 |
| 400 | ORG.0041 | 组织类型不符合校验规则 | Organization type does not meet verification rules | Please check whether the organization type field in the request parameters complies with the verification rules in 【Enterprise Center - User - Organization Attribute Definition】 |
| 400 | ORG.0042 | 上级组织不符合校验规则 | The parent organization does not meet the verification rules | Please check whether the parent organization field in the request parameters complies with the verification rules in 【Enterprise Center - User - Organization Attribute Definition】 |
| 400 | ORG.0044 | 显示顺序不符合校验规则 | The organization sequence number does not meet the verification rules | Please check whether the display sequence field in the request parameters complies with the verification rules in 【Enterprise Center - User - Organization Attribute Definition】 |
| 400 | ORG.0047 | 扩展属性[{0}]不符合校验规则 | Extension property [{0}] does not meet verification rules | Please check whether the extension attribute [{0}] field in the request parameters complies with the verification rules in 【Enterprise Center - User - Organization Attribute Definition】 |