组织

组织信息

GET http://{host}:{port}/v1/admin/organizations/{org_code}?access_token={access_token}
1

请求头部:

请求头说明
Content-Typeapplication/json

请求参数:

字段类型是否必填说明
access_tokenStringY访问token
org_codeStringY组织标识

响应示例:

{
  "status": 0,
  "message": "ok",
  "result": {
    "id": "组织id",
    "domain_id": "域标识",
    "org_code": "组织标识(org_code)",
    "type": "根结点为CORP,其他节点为CORP或DEPT",
    "path": "组织路径",
    "name": "组织名称",
    "en_name": "组织英文名称",
    "tw_name": "组织繁体名称",
    "logo": "组织logo,媒体ID",
    "sort_order": 1,
    "level": 1,
    "uuid": "唯一编码",
    "owner_id": "拥有者userId",
    "owner": "拥有者userId",
    "owner_name": "拥有者",
    "created": 1534829681346, // 创建时间,13位时间戳
    "last_modified": 1564998633361, // 最后修改时间,13位时间戳
    "disabled": false, // 使用禁用,false为有效组织
    "employee_count": 0, // 当前节点雇员数
    "all_employee_count": 0, // 总雇员数
    "employees": [
    ],
    "children": [
    ]
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

组织架构列表

GET http://{host}:{port}/v1/admin/organizations/{code}/page-orgs?access_token={access_token}&kw={kw}&refresh_time={refresh_time}&skip={skip}&limit={limit}
1

请求头部:

请求头说明
Content-Typeapplication/json

请求参数:

字段类型是否必填说明
domain_idStringY域信息
codeStringY组织标识
kwStringN搜索条件
refresh_timeLongN更新时间,用于增量获取
skipIntegerN分页查询条件
limitIntegerN分页查询条件

请求示例:

/v1/admin/organizations/xxxx/page-orgs?access_token=xxxx&skip=0&limit=1
1

响应示例:

{
  "status": 0,
  "message": "ok",
  "result": {
    "total_count": 56,
    "records": [
      {
        "id": "bbb",
        "domain_id": "xxx",
        "org_code": "xxxxx",
        "parent_org_id": "aaa",
        "type": "DEPT",
        "path": "/aaa/bbb/",
        "name": "bbbName",
        "sort_order": 1,
        "level": 2,
        "uuid": "bbb",
        "sn": "1",
        "owner_id": "xxxx",
        "owner": "xxxx",
        "owner_name": "xxxx",
        "created": 1576578664410,
        "last_modified": 1576578664410,
        "disabled": false,
        "employee_count": 0,
        "all_employee_count": 0,
        "employees": [
        ],
        "children": [
        ]
      }
    ]
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

组织架构视图

GET http://{host}:{port}/v1/admin/organizations/{code}/view?access_token={access_token}&org_id={org_id}&employee_skip={employee_skip}&employee_limit={employee_limit}&org_skip={org_skip}&org_limit={org_limit}&counting={counting}
1

请求头部:

请求头说明
Content-Typeapplication/json

请求参数:

字段类型是否必填说明
domain_idStringY域信息
codeStringY组织标识
org_idStringN节点ID,不传则查根节点
employee_skipIntegerN雇员分页查询条件
employee_limitIntegerN雇员分页查询条件
org_skipIntegerN组织分页查询条件
org_limitIntegerN组织分页查询条件
countingBooleanN是否统计雇员树,默认true

请求示例:

/v1/admin/organizations/xxxxx/view?access_token=xxxxx&org_id=bbb&employee_skip=0&employee_limit=1&org_skip=0&org_limit=1
1

响应示例:

{
  "status": 0, 
  "message": "ok", 
  "result": [
    {
      "id": "bbb", 
      "domain_id": "xxx", 
      "org_code": "xxx", 
      "parent_org_id": "aaa", 
      "type": "CORP", 
      "path": "/aaa/bbb/", 
      "name": "部门11", 
      "sort_order": 2, 
      "level": 2, 
      "uuid": "bbb", 
      "sn": "2", 
      "owner_id": "xxx", 
      "owner": "xxx", 
      "owner_name": "xxx", 
      "created": 1536828491327, 
      "last_modified": 1559113350544, 
      "disabled": false, 
      "employee_count": 15, 
      "all_employee_count": 17, 
      "parent_org_name": "xxxx", 
      "directly_corp": {
        "id": "aaa", 
        "name": "xxx", 
        "type": "O", 
        "path": "/aaa/", 
        "display": true
      }, 
      "employees": [
        {
          "id": "xxx", 
          "type": "EMPLOYEE", 
          "domain_id": "xxx", 
          "org_code": "xxx", 
          "display_name": "xxxx", 
          "name": "xxx", 
          "pinyin": "xxx", 
          "initial": "xxx", 
          "mobile": "xxx", 
          "email": "xxx@xxx.com", 
          "status": "ACTIVATED", 
          "user_id": "xxx", 
          "username": "xxx", 
          "nickname": "xxx", 
          "avatar": "xxx", 
          "sort_order": 2, 
          "senior": false, 
          "locked": false, 
          "employee_rank": 0, 
          "tags": [ ], 
          "tag_names": [ ], 
          "positions": [
            {
              "id": "xxxx", 
              "domain_id": "xxx", 
              "code": "xxx", 
              "employee_id": "xxx", 
              "org_id": "bbb", 
              "path": "/aaa/bbb/", 
              "type": "CORP", 
              "job_title": "xxxx", 
              "level": 2, 
              "primary": true, 
              "chief": false, 
              "display_nodes": [
                {
                  "id": "aaa", 
                  "name": "xxxx", 
                  "type": "CORP", 
                  "path": "/aaa/", 
                  "display": true
                }, 
                {
                  "id": "bbb", 
                  "name": "xxx", 
                  "type": "CORP", 
                  "path": "/aaa/bbb/", 
                  "display": true
                }
              ], 
              "full_name_path": "/xxx/xxx/", 
              "org_name": "xxx"
            }
          ], 
          "data_schemas": [ ], 
          "properties": [ ], 
          "created": 1554085163675, 
          "last_modified": 1590636295123, 
          "root_org_info": {
            "id": "", 
            "name": "", 
            "type": "", 
            "path": "", 
            "display": true
          }, 
          "platforms": [ ]
        }
      ], 
      "children": [
        {
          "id": "ccc", 
          "domain_id": "xxxx", 
          "org_code": "xxx", 
          "parent_org_id": "bbb", 
          "type": "DEPT", 
          "path": "/aaa/bbb/ccc/", 
          "name": "部门1-1", 
          "sort_order": 999, 
          "level": 3, 
          "uuid": "ccc", 
          "owner_id": "xxx", 
          "owner": "xxx", 
          "owner_name": "xxx", 
          "created": 1537412001987, 
          "last_modified": 1537412001987, 
          "disabled": false, 
          "employee_count": 2, 
          "all_employee_count": 2, 
          "parent_org_name": "xxxx", 
          "directly_corp": {
            "id": "bbb", 
            "name": "xxx", 
            "type": "O", 
            "path": "/aaa/bbb/", 
            "display": true
          }, 
          "employees": [ ], 
          "children": [ ], 
          "full_name_path": "/aaa/bbb/ccc/"
        }
      ], 
      "full_name_path": "/aaaName/bbbName/"
    }
  ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139

获取指定机构信息

GET http://{host}:{port}/v1/admin/organizations/{org_code}/{id}?access_token={access_token}
1

请求头部:

请求头说明
Content-Typeapplication/json

请求参数:

字段类型是否必填说明
access_tokenStringY访问token
org_codeStringY组织标识
idStringY组织id

响应示例:

{
  "status": 0,
  "message": "ok",
  "result": {
    "id": "节点ID",
    "domain_id": "域",
    "org_code": "组织code",
    "parent_org_id": "父节点ID",
    "type": "CORP",
    "path": "/aaa/bbb/",
    "name": "导入组1",
    "sort_order": 3,
    "level": 2,
    "uuid": "节点ID",
    "sn": "节点编号",
    "owner_id": "拥有者ID",
    "owner": "拥有者ID",
    "owner_name": "拥有者",
    "created": 1554085163677, // 创建时间,13位时间戳
    "last_modified": 1555145213090, // 修改时间,13位时间戳
    "disabled": false, // 使用禁用,false为有效节点
    "employee_count": 0, // 当前节点雇员数
    "all_employee_count": 0, // 总雇员数
    "employees": [
    ],
    "children": [
    ]
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

根据 serialNo 获取机构信息

GET http://{host}:{port}/v1/admin/organizations/{code}/serial/{serialNo}?access_token={access_token}
1

请求头部:

请求头说明
Content-Typeapplication/json

请求参数:

字段类型是否必填说明
domain_idStringY域信息
codeStringY组织标识
serialNoStringY第三方序列号

请求示例:

/v1/admin/organizations/xxxx/serial/xxx?access_token=xxxx
1

响应示例:

{
  "status": 0,
  "message": "ok",
  "result": {
    "id": "节点ID",
    "domain_id": "域",
    "org_code": "组织code",
    "parent_org_id": "父节点ID",
    "type": "CORP",
    "path": "/aaa/bbb/",
    "name": "导入组1",
    "sort_order": 3,
    "serial_no": "xxx",
    "level": 2,
    "uuid": "节点ID",
    "sn": "节点编号",
    "owner_id": "拥有者ID",
    "owner": "拥有者ID",
    "owner_name": "拥有者",
    "created": 1554085163677, // 创建时间,13位时间戳
    "last_modified": 1555145213090, // 修改时间,13位时间戳
    "disabled": false, // 使用禁用,false为有效节点
    "employee_count": 0, // 当前节点雇员数
    "all_employee_count": 0, // 总雇员数
    "employees": [
    ],
    "children": [
    ]
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

新增机构信息

POST http://{host}:{port}/v1/admin/organizations/{org_code}?access_token={access_token}
1

请求头部:

请求头说明
Content-Typeapplication/json

请求参数:

字段类型是否必填说明
access_tokenStringY访问token
org_codeStringY组织标识
typeStringY节点类型,DEPT或者CORP
parent_pathStringN父节点path
parent_idStringN父节点ID,与parent_path不能同时为空
nameStringY节点名称
logoStringNlogo媒体ID
telStringN电话
contactStringN联系人
snStringN节点编号
serial_noStringN第三方序列号,唯一
sort_orderIntegerN排序号

请求示例:

{
  "name": "节点名", 
  "type": "CORP", 
  "parent_id": "xxx"
}
1
2
3
4
5
{
  "name": "节点名", 
  "type": "CORP", 
  "parent_path": "/节点名字1/节点名字2/"
}
1
2
3
4
5

响应示例:

{
  "status": 0,
  "message": "ok",
  "result": {
    // result
  }
}
1
2
3
4
5
6
7

修改机构信息

POST http://{host}:{port}/v1/admin/organizations/{org_code}/{id}?access_token={access_token}
1

请求头部:

请求头说明
Content-Typeapplication/json

请求参数:

字段类型是否必填说明
access_tokenStringY访问token
org_codeStringY组织标识
idStringY组织id
nameStringN节点name
logoStringN节点logo
telStringN节点tel
contactStringN节点联系人
serial_noStringN节点第三方序列号
sort_orderStringN排序号
snStringN节点编号
typeStringN节点类型
new_parentIdStringN父节点id

请求示例:

{
  "name": "新名字"
}
1
2
3

响应示例:

{
  "status": 0,
  "message": "ok",
  "result": {
    // result
  }
}
1
2
3
4
5
6
7

删除机构信息

DELETE http://{host}:{port}/v1/admin/organizations/{org_code}/{id}?access_token={access_token}
1

请求头部:

请求头说明
Content-Typeapplication/json

请求参数:

字段类型是否必填说明
access_tokenStringY访问token
org_codeStringY组织标识
idStringY组织id

响应示例:

{
  "status": 0,
  "message": "ok",
  "result": {
    // result
  }
}
1
2
3
4
5
6
7

错误返回值:

statusmessage
208507组织下已存在雇员
208502没有对应的组织

导入机构信息

POST http://{host}:{port}/v1/admin/organizations/{org_code}/import-orgs?access_token={access_token}
1

请求头部:

请求头说明
Content-Typeapplication/json

请求参数:

字段与新增一致。

字段类型是否必填说明
access_tokenStringY访问token
org_codeStringY组织标识

请求示例:

[
  {
    "name": "CCC", 
    "type": "CORP", 
    "parent_path": "AAA/BBB"
  }, 
  {
    "name": "DDD", 
    "type": "CORP", 
    "parent_path": "AAA/BBB"
  }
]
1
2
3
4
5
6
7
8
9
10
11
12

响应参数:

字段类型是否必填说明
successesMap[String, String]Y导入成功组织,key为组织路径,value为组织id
failuresMap[String, String]Y导入成功组织,key为组织路径,value为错误信息

响应示例:

{
  "status": 0, 
  "message": "Everything is ok.", 
  "result": {
    "successes": {
      "AAA/BBB/CCC": 2699
    }, 
    "failures": {
      "AAA/BBB/DDD": "错误信息"
    }
  }
}
1
2
3
4
5
6
7
8
9
10
11
12

组织架构树

不推荐使用!!

GET http://{host}:{port}/v1/admin/organizations/{code}/tree?access_token={access_token}&org_id={org_id}
1

请求头部:

请求头说明
Content-Typeapplication/json

请求参数:

字段类型是否必填说明
domain_idStringY域信息
codeStringY组织标识
org_idStringN节点ID,不传则查根节点

请求示例:

/v1/admin/organizations/{code}/tree?access_token={token}
1

响应示例:

{
  "status": 0, 
  "message": "ok", 
  "result": {
    "id": "aaa", 
    "domain_id": "xxx", 
    "org_code": "xxx", 
    "type": "CORP", 
    "path": "/aaa/", 
    "name": "xxx", 
    "en_name": "xxx", 
    "tw_name": "xxx", 
    "logo": "xxx", 
    "sort_order": 1, 
    "level": 1, 
    "uuid": "aaa", 
    "owner_id": "xxxx", 
    "owner": "xxxx", 
    "created": 1534829681346, 
    "last_modified": 1564998633361, 
    "disabled": false, 
    "children": [
      {
        "id": "bbb", 
        "domain_id": "xxx", 
        "org_code": "xxx", 
        "parent_org_id": "aaa", 
        "type": "DEPT", 
        "path": "/aaa/bbb/", 
        "name": "xxx", 
        "sort_order": 1, 
        "level": 2, 
        "uuid": "bbb", 
        "sn": "1", 
        "owner_id": "xxx", 
        "owner": "xxx", 
        "created": 1576578664410, 
        "last_modified": 1576578664410, 
        "disabled": false, 
        "children": [ ]
      }
    ]
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

组织架构列表

不推荐使用!!

GET http://{host}:{port}/v1/admin/organizations/{code}/list-all?access_token={access_token}&org_id={org_id}
1

请求头部:

请求头说明
Content-Typeapplication/json

请求参数:

字段类型是否必填说明
domain_idStringY域信息
codeStringY组织标识
org_idStringN节点ID,不传则查根节点

请求示例:

/v1/admin/organizations/{code}/list-all?access_token={token}
1

响应示例:

{
  "status": 0, 
  "message": "ok", 
  "result": [
    {
      "id": "aaa", 
      "domain_id": "xxx", 
      "org_code": "xxx", 
      "type": "CORP", 
      "path": "/aaa/", 
      "name": "xxx", 
      "en_name": "xxx", 
      "tw_name": "xxx", 
      "logo": "xxx", 
      "sort_order": 1, 
      "level": 1, 
      "uuid": "aaa", 
      "owner_id": "xxx", 
      "owner": "xxx", 
      "owner_name": "xxx", 
      "created": 1534829681346, 
      "last_modified": 1564998633361, 
      "disabled": false, 
      "employee_count": 0, 
      "all_employee_count": 0, 
      "employees": [ ], 
      "children": [ ]
    }
  ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
上次编辑于: