Link Search Menu Expand Document
  1. 接口调用说明
  2. 创建部门
  3. 查看组织下的部门树
  4. 读取部门Name信息
  5. 查看部门详情
  6. 更新组织的部门
  7. 删除组织的部门

接口调用说明

此页面上的所有端点都以BaseUrl为首拼接,您的baseUrl如下所示:

https://${yourXAuthDomain}

SSWS Token:

请求以下的API需要包含api_token, 通过管理员登录XAuth的控制台,【API】-【Token】-【创建token】来创建调用管理API的Token

创建部门

GET **${baseUrl}/api/v1/account/org/{orgId}/department

获取租户下的用户列表的详情

请求示例

curl -X 'POST' \
  'https://${yourXAuthDomain}/api/v1/account/org/QnQHMG7d/department?department=Product' \
  -H 'accept: application/json' \
  -H 'Authorization: SSWS ${api_token}'

响应示例

{
  "depId": "mqzLBuZy",
  "success": true
}
参数 描述 类型
depId 部门的Id,唯一标识 String
success 是否成功 bool

查看组织下的部门树

GET ${baseUrl}/api/v1/account/org/{orgId}/tree

获取指定组织树(未包含成员), 仅包含部门的信息,不包含部门人员信息

请求示例

curl -X 'GET' \
  'http://${yourXAuthDomain}/api/v1/account/org/WAoUgfsM/tree' \
  -H 'accept: application/json' \
  -H 'Authorization: SSWS ${api_token}'

响应示例

{
  "levelCount": 553,
  "treeStruct": [
    {
      "parentId": "53dYhGNsrNKZG7RV",
      "name": "风控线",
      "depId": "hvanixnw",
      "originId": "50049451"
    },
    {
      "parentId": "",
      "name": "顾问",
      "depId": "53dYhGNs",
      "originId": "50035673"
    }
    ]
}
参数 描述 类型
levelCount 部门数量 String
name 部门的名字 String
originId 外部Id Sting
parentId 父部门节点的部门Id String
depId 部门名称 String

读取部门Name信息

POST ${baseUrl}/api/v1/account/org/:orgId/departments

读取部门name信息。结果Map中Map Key为部门ID,Value为部门Name

请求示例

curl -X 'POST' \
  'https://${yourXAuthDomain}/api/v1/account/org/:orgId/departments' \
  -H 'accept: application/json' \
  -H 'Authorization: SSWS ${api_token}' \
  -H 'Content-Type: application/json' \
  -d 'orgId:string'\
  -d '["depId"]'\
参数 描述 是否必填 类型
orgId 组织ID String
depId 部门ID String

响应示例

{
    "664606056": "运营部"
}

查看部门详情

GET ${baseUrl}/api/v1/account/org/{OrgId}/department/{depId}

查看组织的指定部门的详细信息,包含组织名称、组织ID、成员数量等。

请求示例

curl -X 'GET' \
  'https://${yourXAuthDomain}/api/v1/account/org/:orgId/department/:depId' \
  -H 'accept: application/json' \
  -H 'Authorization: SSWS ${api_token}' 
参数 描述 是否必填 类型
orgId 组织ID String
depId 部门ID String

响应示例

{
  "name": "Product",
  "id": "mqzLBuZy",
  "memberCount": 0,
  "subordinateDep": [
    {
      "subordinateDepId": "6QcUDPVH",
      "subordinateDepLabel": "Mock"
    },
    {
      "subordinateDepId": "dDHiqsn4",
      "subordinateDepLabel": "Design"
    }
  ],
  "lastUpdated": "2022-07-04T17:17:36.552222",
  "created": "2022-07-04T17:17:36.552234",
  "lastMembershipUpdated": "2022-07-04T17:17:36.552237"
}
参数 描述 类型
id 部门的唯一标识 String
name 部门的名字 String
subordinateDep 子部门的Id 和名称 Array
subordinateDepId 子部门的Id String
subordinateDepLabel 子部门的名称 String
type 本地 or 其他身份源 String
memberCount 部门下用户成员的数量 String
lastUpdated 最后更新的时间 datetime
created 部门创建的时间 datetime
lastMembershipUpdated 部门成员更新的时间 datetime

更新组织的部门

PUT ${baseUrl}/api/v1/account/org/:orgId/department/:depId

更新组织的部门

请求示例

curl -X 'PUT' \
  'https://${yourXAuthDomain}/api/v1/account/org/:orgId/department/:depId' \
  -H 'Content-Type:application/json'\
  -H 'accept: application/json' \
  -H 'Authorization: SSWS ${api_token}'\
  -d 'orgId:string,depId:string'\
  -d '{
  "groupName": "string"
}'
参数 描述 是否必填 类型
orgId 组织ID String
depId 部门ID String
groupName 部门名称 String

响应示例

null

删除组织的部门

DELETE ${baseUrl}/api/v1/account/org/:orgId/department/:depId?force=false

删除组织的部门

请求示例

curl -X 'POST' \
  'https://${yourXAuthDomain}/api/v1/account/org/:orgId/department/:depId?force=false' \
  -H 'accept: application/json' \
  -H 'Authorization: SSWS ${api_token}' \
  -d 'orgId:string'\
  -d 'depId:string'
参数 描述 是否必填 类型
orgId 组织ID,该属性必须唯一 String
depId 部门ID,该属性必须唯一 String

响应示例

null