[1. 获取组织下所有机构](#1)
[2. 导入机构](#2)
[3. 组织架构列表](#3)
[4. 获取指定机构信息](#4)
[5. 根据serialNo获取机构信息](#5)
[6. 获取组织信息](#6)
[7. 获取组织配置](#7)
[8. 创建机构](#8)
[9. 更新机构](#9)
[10. 解散公司/部门](#10)
[11. 分页查询](#11)
# 组织(admin)
---
## 1. 获取组织下所有机构
####GET
~~~
/v1/admin/organizations/{code}/list-all?access_token={access_token}
~~~
####请求头
|请求头|说明 |
|---|---|
| Content-Type |application/json|
#### 请求参数
| 字段| 类型 | 是否必填|说明|
|---|---|---|---|
|access_token|String|Y|访问令牌|
|code|String|Y|组织标识|
#### 请求示例
~~~
/v1/admin/organizations/85939199-6424-4f28-84d4-fce2aedf0e64/list-all?access_token=b646339e2f4f4234af6bae5f72db9879
~~~
#### 返回数据
~~~
application/json
~~~
~~~
{
"status": 0,
"message": "Everything is ok.",
"result": [
{
"domain_id": "atwork",
"org_code": "85939199-6424-4f28-84d4-fce2aedf0e64",
"operator": "a86e83a26be44eb59806901cc8be5d5c",
"id": 412,
"name": "817aa",
"tel": "131118",
"path": "/144/403/404/411/412/",
"type": "DEPT",
"root": false,
"sort_order": 999,
"level": 5,
"uuid": "27cb057e-bd1b-4180-818b-3a0f5affe018",
"created": 1473752058701,
"last_modified": 1474453093313,
"expired": 218310998400000,
"disabled": false,
"directly_corp": {
"id": 411,
"name": "深圳"
},
"parent_org_id": 411,
"parent_org_name": "深圳",
"root_com_id": 144,
"root_com_name": "研发部",
"employee_count": 0,
"all_employee_count": 0,
"children": [ ],
"employees": [ ],
"counting": true
}
]
}
~~~
#### 错误返回值
| status | message |说明|
|---|---|---|
| 10011 |token not found.|访问令牌不存在|
---
## 2. 导入机构
####POST
~~~
/v1/admin/organizations/{code}/import-orgs?access_token={access_token}
~~~
####请求头
|请求头|说明 |
|---|---|
| Content-Type |application/json|
#### 请求参数
| 字段| 类型 | 是否必填|说明|
|---|---|---|---|
|access_token|String|Y|访问令牌|
|type|String|Y|CORP/DEPT,枚举,分别代表公司/部门|
|name|String|Y|名称|
|sn|String|N|编号|
|tel|String|N|电话|
|serialNo|String|N|序列号|
|parent_path|String|N|父节点目录,与parent_id不能同时为空|
|parent_id|String|N|父节点ID,与parent_path不能同时为空|
|moreInfo|Map|N|其他需要存储的信息|
#### 请求示例
~~~
/v1/admin/organizations/85939199-6424-4f28-84d4-fce2aedf0e64/import-orgs?access_token=b646339e2f4f4234af6bae5f72db9879
~~~
~~~
{
"parent_path": "研发部/财经管理部",
"type": "DEPT",
"name": "测试导入"
}
~~~
#### 返回数据
~~~
application/json
~~~
~~~
{
"status": 0,
"message": "Everything is ok.",
"result": 2692
}
~~~
#### 错误返回值
| status | message |说明|
|---|---|---|
| 10011 |token not found.|访问令牌不存在|
---
## 3. 组织架构列表
####GET
~~~
/v1/admin/organizations?access_token={access_token}
~~~
####请求头
|请求头|说明 |
|---|---|
| Content-Type |application/json|
#### 请求参数
| 字段| 类型 | 是否必填|说明|
|---|---|---|---|
|access_token|String|Y|访问令牌|
#### 请求示例
~~~
/v1/admin/organizations?access_token=b646339e2f4f4234af6bae5f72db9879
~~~
#### 返回数据
~~~
application/json
~~~
~~~
{
"status": 0,
"message": "Everything is ok.",
"result": [
{
"domain_id": "atwork",
"org_code": "c06bee10-a20e-4abc-94a5-f6c7de0e0cc5",
"operator": "c24b6a94cfb14b79af12a1399edc9e31",
"id": 146,
"name": "测试组织2",
"pinyin": "ceshizuzhi2",
"initial": "cszz2",
"sn": "",
"tel": "",
"logo": "Z3JvdXAxL00wMC8wMC80RC9yQkFCR1ZkamFoNkFMVVJSQUFBVjlhMlB1b0EzOTcuanBn",
"province": "广东省",
"city": "清远市",
"industry": "IT服务",
"path": "/146/",
"type": "ORG",
"owner": "c24b6a94cfb14b79af12a1399edc9e31",
"sort_order": 999,
"level": 1,
"uuid": "3a6a1464-57fd-4c12-9e6f-46fafb18a51f",
"created": 1466133070410,
"last_modified": 1466133070415,
"expired": 218310998400000,
"disabled": false
}
]
}
~~~
#### 错误返回值
| status | message |说明|
|---|---|---|
| 10011 |token not found.|访问令牌不存在|
---
## 4. 获取指定机构信息
####GET
~~~
/v1/admin/organizations/{code}/{orgId}?access_token={access_token}
~~~
####请求头
|请求头|说明 |
|---|---|
| Content-Type |application/json|
#### 请求参数
| 字段| 类型 | 是否必填|说明|
|---|---|---|---|
|access_token|String|Y|访问令牌|
|code|String|Y|组织标识|
|org_id|String|N|组织ID|
#### 请求示例
~~~
/v1/admin/organizations/a918d8a6-67e9-4e76-8503-baa73d3c6fd2/301?access_token=b646339e2f4f4234af6bae5f72db9879
~~~
#### 返回数据
~~~
application/json
~~~
| 字段| 类型 |说明|
|---|---|---|
| level |int|机构层级|
| counting |boolean|是否计算该机构下雇员数|
~~~
{
"status": 0,
"message": "Everything is ok.",
"result": {
"domain_id": "atwork",
"org_code": "a918d8a6-67e9-4e76-8503-baa73d3c6fd2",
"operator": "a3fc7b78b38f422d9bdcab3cfb47b1ba",
"id": 301,
"name": "测试部门群",
"sn": "",
"path": "/232/301/",
"type": "DEPT",
"root": false,
"sort_order": 999,
"level": 2,
"uuid": "cb58ddd2-15b8-42d4-990d-1ee447bddfa6",
"created": 1471945856057,
"last_modified": 1471945856072,
"expired": 218310998400000,
"disabled": false,
"directly_corp": {
"id": 232,
"name": "XXX集团"
},
"parent_org_id": 232,
"parent_org_name": "XXX集团",
"root_com_id": 232,
"root_com_name": "XXX集团",
"employee_count": 0,
"all_employee_count": 0,
"children": [ ],
"employees": [ ],
"counting": true
}
}
~~~
#### 错误返回值
| status | message |说明|
|---|---|---|
| 10011 |token not found.|访问令牌不存在|
---
## 5. 根据serialNo获取机构信息
####GET
~~~
/v1/admin/organizations/{code}/serial/{serialNo}?access_token={access_token}
~~~
####请求头
|请求头|说明 |
|---|---|
| Content-Type |application/json|
#### 请求参数
| 字段| 类型 | 是否必填|说明|
|---|---|---|---|
|access_token|String|Y|访问令牌|
|code|String|Y|组织标识|
|serialNo|String|N|第三方组织标识|
#### 请求示例
~~~
/v1/admin/organizations/85939199-6424-4f28-84d4-fce2aedf0e64/serial/efbfbd02ddbd260a3e45efbfbdd1b4efbfbd5b7310efbfbd?access_token=b646339e2f4f4234af6bae5f72db9879
~~~
#### 返回数据
~~~
application/json
~~~
| 字段| 类型 |说明|
|---|---|---|
| level |int|机构层级|
| counting |boolean|是否计算该机构下雇员数|
~~~
{
"status": 0,
"message": "Everything is ok.",
"result": {
"domain_id": "atwork",
"org_code": "85939199-6424-4f28-84d4-fce2aedf0e64",
"operator": "a86e83a26be44eb59806901cc8be5d5c",
"id": 422,
"name": "游来游去",
"tel": "163906",
"serial_no": "efbfbd02ddbd260a3e45efbfbdd1b4efbfbd5b7310efbfbd",
"path": "/144/421/422/",
"type": "CORP",
"root": false,
"sort_order": 999,
"level": 3,
"uuid": "0103fb3b-61f1-4b80-a7b3-dda591aac891",
"created": 1475134179267,
"last_modified": 1475230440345,
"expired": 218310998400000,
"disabled": false,
"directly_corp": {
"id": 421,
"name": "广东省"
},
"parent_org_id": 421,
"parent_org_name": "广东省",
"root_com_id": 144,
"root_com_name": "研发部",
"employee_count": 0,
"all_employee_count": 0,
"children": [ ],
"employees": [ ],
"counting": true
}
}
~~~
#### 错误返回值
| status | message |说明|
|---|---|---|
| 10011 |token not found.|访问令牌不存在|
---
## 6. 获取组织信息
####GET
~~~
/v1/admin/organizations/{code}?access_token={access_token}
~~~
####请求头
|请求头|说明 |
|---|---|
| Content-Type |application/json|
#### 请求参数
| 字段| 类型 | 是否必填|说明|
|---|---|---|---|
|access_token|String|Y|访问令牌|
|code|String|Y|组织标识|
#### 请求示例
~~~
/v1/admin/organizations/85939199-6424-4f28-84d4-fce2aedf0e64?access_token=b646339e2f4f4234af6bae5f72db9879
~~~
#### 返回数据
~~~
application/json
~~~
~~~
{
"status": 0,
"message": "Everything is ok.",
"result": {
"domain_id": "atwork",
"org_code": "85939199-6424-4f28-84d4-fce2aedf0e64",
"operator": "a86e83a26be44eb59806901cc8be5d5c",
"id": 144,
"name": "研发部",
"pinyin": "yanfabu",
"initial": "yfb",
"sn": "",
"tel": "",
"logo": "Z3JvdXAxL00wMC8wMC80Qi9yQkFCR1ZkaVl4aUFlMDgyQUFBVjlhMlB1b0E5OTguanBn",
"province": "广东省",
"city": "清远市",
"industry": "电子商务",
"path": "/144/",
"type": "ORG",
"owner": "a86e83a26be44eb59806901cc8be5d5c",
"sort_order": 999,
"level": 1,
"uuid": "855b1d7d-ec14-43ec-9043-62b302f6f615",
"created": 1466065929511,
"last_modified": 1466663835985,
"expired": 218310998400000,
"disabled": false
}
}
~~~
#### 错误返回值
| status | message |说明|
|---|---|---|
| 10011 |token not found.|访问令牌不存在|
---
## 7. 获取组织配置
####GET
~~~
/v1/admin/organizations/{code}/settings?access_token={access_token}
~~~
####请求头
|请求头|说明 |
|---|---|
| Content-Type |application/json|
#### 请求参数
| 字段| 类型 | 是否必填|说明|
|---|---|---|---|
|access_token|String|Y|访问令牌|
|code|String|Y|组织标识|
#### 请求示例
~~~
/v1/admin/organizations/c06bee10-a20e-4abc-94a5-f6c7de0e0cc5/settings?access_token=b646339e2f4f4234af6bae5f72db9879
~~~
#### 返回数据
~~~
application/json
~~~
| 字段| 类型 |说明|
|---|---|---|
| view_type |String|通用视图设置,ALL/DIRECT_AND_ALL_SUPERIOR_CORP/DIRECT_AND_SUPERIOR_CORP/DIRECT_CORP/CUSTOM|
| counting |boolean|是否显示人数统计|
| level |boolean|最大组织数|
| corp_alias |String|公司别名|
| dept_alias |String|部门别名|
| node_select |String|选择人员设置,employee/org/both|
| cycle_settings/enabled |boolean|是否开启我的圈子|
| cycle_settings/anonymous |boolean|是否开启马甲功能|
| theme_settings/type |String|主题类型,SYSTEM/CUSTOM|
| theme_settings/theme |String|主题|
| vpn_enabled |boolean|vpn功能是否开启|
| voip_enabled |boolean|语音视频开关是否开启|
~~~
{
"status": 0,
"message": "Everything is ok.",
"result": {
"org_code": "c06bee10-a20e-4abc-94a5-f6c7de0e0cc5",
"domain_id": "atwork",
"view_type": "ALL",
"counting": true,
"level": 32767,
"corp_alias": "公司",
"dept_alias": "部门",
"node_select": "both",
"cycle_settings": {
"enabled": true,
"anonymous": false
},
"email_settings": [ ],
"theme_settings": {
"type": "SYSTEM",
"theme": "skyblue"
},
"vpn_enabled": false,
"vpn_settings": [ ],
"voip_enabled": false,
"white_lists": [ ],
"create_time": 1479120340469,
"modify_time": 1482486250113
}
}
~~~
#### 错误返回值
| status | message |说明|
|---|---|---|
| 10011 |token not found.|访问令牌不存在|
---
## 8. 创建机构
####POST
~~~
/v1/admin/organizations/{code}?access_token={access_token}
~~~
####请求头
|请求头|说明 |
|---|---|
| Content-Type |application/json|
#### 请求参数
| 字段| 类型 | 是否必填|说明|
|---|---|---|---|
|access_token|String|Y|访问令牌|
|code|String|Y|组织标识|
|type|String|Y|CORP/DEPT,枚举,分别代表公司/部门|
|name|String|Y|名称|
|sn|String|N|编号|
|tel|String|N|电话|
|serialNo|String|N|序列号|
|parent_path|String|N|父节点目录,与parent_id不能同时为空|
|parent_id|String|N|父节点ID,与parent_path不能同时为空|
|moreInfo|Map|N|其他需要存储的信息|
#### 请求示例
~~~
/v1/admin/organizations?access_token=b646339e2f4f4234af6bae5f72db9879
~~~
~~~
{
"name": "新增公司",
"type": "CORP",
"parent_id": 2693
}
~~~
#### 返回数据
~~~
application/json
~~~
~~~
{
"status": 0,
"message": "Everything is ok.",
"result": {
}
}
~~~
#### 错误返回值
| status | message |说明|
|---|---|---|
| 10011 |token not found.|访问令牌不存在|
---
## 9. 更新机构
####POST
~~~
/v1/admin/organizations/{code}/{orgId}?access_token={access_token}
~~~
####请求头
|请求头|说明 |
|---|---|
| Content-Type |application/json|
#### 请求参数
| 字段| 类型 | 是否必填|说明|
|---|---|---|---|
|access_token|String|Y|访问令牌|
|code|String|Y|组织标识|
|orgId|Long|Y|修改的公司/部门标识|
|ops|Strnig|N|操作类型,"REMOVE"为删除|
|type|String|Y|CORP/DEPT,枚举,分别代表公司/部门|
|name|String|N|名称|
|sn|String|N|编号|
|tel|String|N|电话|
|serialNo|String|N|序列号|
|moreInfo|Map|N|其他需要存储的信息|
#### 请求示例
~~~
/v1/admin/organizations/b77300e2-81c5-40e4-991f-c00525551176/2694?access_token=b646339e2f4f4234af6bae5f72db9879
~~~
~~~
{
"name": "新增公司名称",
"type": "CORP"
}
~~~
#### 返回数据
~~~
application/json
~~~
~~~
{
"status": 0,
"message": "Everything is ok.",
"result": { }
}
~~~
#### 错误返回值
| status | message |说明|
|---|---|---|
| 10011 |token not found.|访问令牌不存在|
| 202002 |没有对应的组织机构|没有对应的组织机构|
---
## 10. 解散公司/部门
####DELETE
~~~
/v1/admin/organizations/{code}/{orgId}?access_token={access_token}
~~~
####请求头
|请求头|说明 |
|---|---|
| Content-Type |application/json|
#### 请求参数
| 字段| 类型 | 是否必填|说明|
|---|---|---|---|
|access_token|String|Y|访问令牌|
|code|String|Y|组织标识|
|orgId|Long|Y|修改的公司/部门标识|
#### 请求示例
~~~
/v1/admin/organizations/b77300e2-81c5-40e4-991f-c00525551176/2694?access_token=b646339e2f4f4234af6bae5f72db9879
~~~
#### 返回数据
~~~
application/json
~~~
~~~
{
"status": 0,
"message": "Everything is ok.",
"result": { }
}
~~~
#### 错误返回值
| status | message |说明|
|---|---|---|
| 10011 |token not found.|访问令牌不存在|
| 202002 |没有对应的组织机构|没有对应的组织机构|
---
## 11. 分页查询
####GET
~~~
/v1/admins/organizations/{code}/page-orgs?access_token={access_token}&skip={skip}&limit={limit}&refresh_time={refresh_time}
~~~
####请求头
|请求头|说明 |
|---|---|
| Content-Type |application/json|
#### 请求参数
| 字段| 类型 | 是否必填|说明|
|---|---|---|---|
|access_token|String|Y|访问令牌|
|code|String|Y|组织orgCode|
| skip |String| N |开始记录数,默认值 0|
| limit |String| N |最大记录数,默认值 10|
| refresh_time |String| N |刷新时间戳,获取刷新时间以后的记录,默认值 -1|
#### 示例
~~~
/v1/admin/organizations/code/page-orgs?access_token=8e0d7b9e4e4a49b888d6b0b5f882b7cd&skip=0&limit=10&refresh_time=-1
~~~
#### 返回数据
~~~
{
"status": 0,
"message": "Everything is ok.",
"result":{
"total_count": 1,
"orgs": [
{
"domain_id": "atwork",
"org_code": "85939199-6424-4f28-84d4-fce2aedf0e64",
"operator": "a86e83a26be44eb59806901cc8be5d5c",
"id": 412,
"name": "817aa",
"tel": "131118",
"path": "/144/403/404/411/412/",
"type": "DEPT",
"root": false,
"sort_order": 999,
"level": 5,
"uuid": "27cb057e-bd1b-4180-818b-3a0f5affe018",
"created": 1473752058701,
"last_modified": 1474453093313,
"expired": 218310998400000,
"disabled": false,
"directly_corp": {
"id": 411,
"name": "深圳"
},
"parent_org_id": 411,
"parent_org_name": "深圳",
"root_com_id": 144,
"root_com_name": "研发部",
"employee_count": 0,
"all_employee_count": 0,
"children": [ ],
"employees": [ ],
"counting": true
}
]
}
}
~~~
#### 错误返回值
| status | message |说明|
|---|---|---|
| 10011 |token not found.|访问令牌不存在|
---
## 19. 获取dataschemas
####GET
~~~
/v1/admin/organizations/{code}/dataschemas/list?access_token={access_token}&visible={visible}
~~~
####请求头
|请求头|说明 |
|---|---|
| Content-Type |application/json|
#### 请求参数
| 字段| 类型 | 是否必填|说明|
|---|---|---|---|
| access_token | String | Y | 访问令牌 |
| code | String | Y | 组织orgCode |
| visible | boolean | N | 该字段是否可见,默认值为true |
#### 示例
~~~
/v1/admin/organizations/85939199-6424-4f28-84d4-fce2aedf0e64/dataschemas/list?access_token=5a63d4791ced4834a333c27c87148702&visible=false
~~~
#### 返回数据
~~~
{
"status": 0,
"message": "Everything is ok.",
"result": [
{
"id": 1960,
"type": "TEL_PHONE",
"domain_id": "atwork",
"org_code": "85939199-6424-4f28-84d4-fce2aedf0e64",
"name": "座机号码",
"alias": "座机号码",
"property": "tel",
"options": [ ],
"min": -1,
"max": -1,
"visible_range": "INVISIBLE",
"ops_range": "ADMIN",
"sort_order": 2007,
"system": true,
"initial": false,
"visible": false,
"sortable": true,
"opsable": false
},
{
"id": 1961,
"type": "TEL_PHONE",
"domain_id": "atwork",
"org_code": "85939199-6424-4f28-84d4-fce2aedf0e64",
"name": "传真号码",
"alias": "传真号码",
"property": "fax",
"options": [ ],
"min": -1,
"max": -1,
"visible_range": "INVISIBLE",
"ops_range": "ADMIN",
"sort_order": 2008,
"system": true,
"initial": false,
"visible": false,
"sortable": true,
"opsable": false
},
{
"id": 1962,
"type": "TEL_PHONE",
"domain_id": "atwork",
"org_code": "85939199-6424-4f28-84d4-fce2aedf0e64",
"name": "工作电话",
"alias": "工作电话",
"property": "workPhone",
"options": [ ],
"min": -1,
"max": -1,
"visible_range": "INVISIBLE",
"ops_range": "ADMIN",
"sort_order": 2009,
"system": true,
"initial": false,
"visible": false,
"sortable": true,
"opsable": false
},
{
"id": 1963,
"type": "MOBILE_PHONE",
"domain_id": "atwork",
"org_code": "85939199-6424-4f28-84d4-fce2aedf0e64",
"name": "其它手机",
"alias": "其它手机",
"property": "otherPhone",
"options": [ ],
"min": -1,
"max": -1,
"visible_range": "INVISIBLE",
"ops_range": "ADMIN",
"sort_order": 2010,
"system": true,
"initial": false,
"visible": false,
"sortable": true,
"opsable": false
},
{
"id": 1964,
"type": "EMAIL",
"domain_id": "atwork",
"org_code": "85939199-6424-4f28-84d4-fce2aedf0e64",
"name": "其它邮箱",
"alias": "其它邮箱",
"property": "otherEmail",
"options": [ ],
"min": -1,
"max": -1,
"visible_range": "INVISIBLE",
"ops_range": "ADMIN",
"sort_order": 2011,
"system": true,
"initial": false,
"visible": false,
"sortable": true,
"opsable": false
},
{
"id": 1965,
"type": "SELECT",
"domain_id": "atwork",
"org_code": "85939199-6424-4f28-84d4-fce2aedf0e64",
"name": "所属地",
"alias": "所属地",
"property": "location",
"options": [ ],
"min": -1,
"max": -1,
"visible_range": "INVISIBLE",
"ops_range": "ADMIN",
"sort_order": 2012,
"system": true,
"initial": false,
"visible": false,
"sortable": true,
"opsable": false
},
{
"id": 1966,
"type": "TEXT",
"domain_id": "atwork",
"org_code": "85939199-6424-4f28-84d4-fce2aedf0e64",
"name": "所属行业",
"alias": "所属行业",
"property": "industry",
"options": [ ],
"min": -1,
"max": -1,
"visible_range": "INVISIBLE",
"ops_range": "ADMIN",
"sort_order": 2013,
"system": true,
"initial": false,
"visible": false,
"sortable": true,
"opsable": false
},
{
"id": 1967,
"type": "TEXT",
"domain_id": "atwork",
"org_code": "85939199-6424-4f28-84d4-fce2aedf0e64",
"name": "所属大区",
"alias": "所属大区",
"property": "region",
"options": [ ],
"min": -1,
"max": -1,
"visible_range": "INVISIBLE",
"ops_range": "ADMIN",
"sort_order": 2013,
"system": true,
"initial": false,
"visible": false,
"sortable": true,
"opsable": false
},
{
"id": 1968,
"type": "TEXT",
"domain_id": "atwork",
"org_code": "85939199-6424-4f28-84d4-fce2aedf0e64",
"name": "标签",
"alias": "标签",
"property": "label",
"options": [ ],
"min": -1,
"max": -1,
"visible_range": "INVISIBLE",
"ops_range": "ADMIN",
"sort_order": 2014,
"system": true,
"initial": false,
"visible": false,
"sortable": true,
"opsable": false
}
]
}
~~~
#### 错误返回值
| status | message |说明|
|---|---|---|
| 10011 |token not found.|访问令牌不存在|
---