获取部门列表

使用场景: 用于获取指定类型的部门列表

权限说明

权限项 说明 备注
应用是否需要申请白名单 不需要
用户凭证 未支持
机构凭证 支持 获取不到用户凭证的后台管理场景使用

请求方式: GET(HTTPS

请求地址: https://jz.hasmartedu.com/oapi/department/list

Query参数:

参数 类型 必填 说明
access_token string 接口调用凭证
id uint32 部门id。获取指定部门及其下的子部门。 如果不填,默认从根节点开始获取
next_level_only int32 只取直属的下一层级
0:表示返回所有子节点
1:表示不返回孙结点以及以下层级的节点 -- 【推荐】按需拉取,可减少时延问题
need_role_node bool 是否需要返回第二层的角色节点,即教师、临时成员、退休老师等的角色根节点
false:不返回
true:返回
department_type int32 要查询的部门类型,查询普通成员部门时无需指定该参数
2:教职工,学校默认值,即学校不填该参数时的效果
5:退休老师
6:临时组
9:教育局员工,教育局默认值,即教育局不填该参数时的效果
15:教育局退休员工
注意:传入部门id时,id的部门类型应该与传入的department_type保持一致

注意:全量查询仅适用于部门数量少的场景;请尽量按需获取,减少全量查询带来的时延问题

获取各角色根接口推荐请求: https://jz.hasmartedu.com/oapi/department/list?access_token=ACCESS_TOKEN&next_level_only=1&need_role_node=true

返回参数:

参数 类型 说明
errcode int32 返回码
errmsg string 对返回码的文本描述内容
参数 类型 说明
errcode int32 返回码
errmsg string 对返回码的文本描述内容
department 部门列表数据
department.id uint32 部门id,在机构内唯一
department.name string 部门名称
department.parentid uint32 父部门id
department.order uint32 在父部门中的次序值。order值越小排序越前。值范围是[0, 2^32)
department.level int32 部门层级
机构根节点为第一层,系统自动生成,不允许修改
角色节点为第二层,系统自动生成,不运行修改
department.code string 部门代码,机构内唯一
department_type int32 部门类型

请求示例:

GET https://jz.hasmartedu.com/oapi/department/list?access_token=ACCESS_TOKEN&id=1001

返回示例:

{
   "errcode": 0,
   "errmsg": "ok",
   "department": [
       {
           "id": 2001,
           "name": "语文组",
           "parentid": 1001,
           "order": 1,
           "level": 3,
           "code": "yuwen"
       },
       {
           "id": 2002,
           "name": "数学组",
           "parentid": 1001,
           "order": 2,
           "level": 3,
           "code": "shuxue"
       }
   ],
 "department_type": 2
}

获取部门详情

使用场景: 获取部门的详情

目前,仅支持获取普通成员部门,即学校老师部门(department_type=2),和行政单位员工部门(department_type=9)

权限说明

权限项 说明 备注
应用是否需要申请白名单 不需要
用户凭证 未支持
机构凭证 支持 获取不到用户凭证的后台管理场景使用

请求方式: GET(HTTPS

请求地址: https://jz.hasmartedu.com/oapi/department/get

Query参数:

参数 类型 必填 说明
access_token string 接口调用凭证
id uint32 部门id。获取指定部门及其下的子部门。 如果不填,默认从根节点开始获取
full_path int32 是否返回部门全路径,0表示不返回,1表示返回

返回参数:

参数 类型 说明
errcode int32 返回码
errmsg string 对返回码的文本描述内容
id uint32 部门ID
name string 部门名字
parentid uint32 上级部门ID
order uint32 在父部门中的次序值,32位整数,越小排序越前
full_id_path string 部门id完整路径
full_path string 部门完整路径
code string 部门代码,机构内唯一

请求示例:

GET https://jz.hasmartedu.com/oapi/department/get?access_token=ACCESS_TOKEN&id=2002&full_path=1

返回示例:

{
  "errcode": 0,
  "errmsg": "ok",
  "id": 2002,
  "name": "教务处",
  "parentid": 1002,
  "order": 2,
  "full_id_path": "/2/1002/2002",
  "full_path": "/示范中学/教师/教务处",
  "code": "1009697_2_448978"
}

批量查询部门详情

使用场景: 根据部门id列表,查询部门的详情

权限说明

权限项 说明 备注
应用是否需要申请白名单 不需要
用户凭证 不支持
机构凭证 支持 -

请求方式: POST (HTTPS

请求地址: https://jz.hasmartedu.com/oapi/common/department/list?access_token=ACCESS_TOKEN

请求包体

{
    "department":[5952576,5952579]
}

参数说明:

参数 类型 必须 说明
access_token string 调用接口凭证,使用机构凭证access_token
department uint32数组 部门ID列表

返回结果:

{
    "errmsg": "ok",
    "errcode": 0,
    "department": [
        {
            "department_id": 5952576,
            "name": "2015级",
            "level": 3,
            "parentid": 5165436,
            "tag": 4,
            "full_path": "/倩倩标准版十中/学生/2015级",
            "department_type": 1,
            "section": 3,
            "code": "1009697_1_352079",
            "standard_grade": 0,
            "register_year": 2015,
            "sort": 3,
            "full_id_path": "/5165435/5165436/5952576"
        },
        {
            "department_id": 5952579,
            "name": "3班",
            "level": 4,
            "parentid": 5952576,
            "tag": 5,
            "full_path": "/倩倩标准版十中/学生/2015级/3班",
            "department_type": 1,
            "section": 3,
            "code": "1009697_1_36741",
            "standard_grade": 0,
            "register_year": 0,
            "sort": 3,
            "full_id_path": "/5165435/5165436/5952576/5952579"
        }
    ]
}

返回值参数说明:

参数 类型 说明
errcode uint32 返回码
errmsg string 对返回码的文本描述内容
department.department_id uint32 部门id
department.name string 部门名称
department.level uint32 层级
department.parentid uint32 父节点
department.tag uint32 部门标签,参数值含义参考《部门标签对照表》
department.full_path string 全路径
department.department_type uint32 部门类型 参数值含义参考《部门类型对照表》
department.section uint32 部门学段,参数值含义参考《部门学段对照表》
department.code string 部门编码
department.standard_grade uint32 标准年级,仅当部门类型为年级(2)时有效,参数值含义参考《标准年级对照表》
department.custom_grade uint32 自定义年级
department.register_year uint32 入学年份,格式为YYYY,仅当部门标签为年级(4)时有效
department.sort uint32 排序值,值越小排前面
department.full_id_path string 部门id的全路径

检索部门

使用场景: 用于检索部门的场景

目前,仅支持获取普通成员部门,即学校老师部门(department_type=2),和行政单位员工部门(department_type=9)

权限说明

权限项 说明 备注
应用是否需要申请白名单 不需要
用户凭证 未支持
机构凭证 支持 获取不到用户凭证的后台管理场景使用

请求方式: POST(HTTPS

请求地址: https://jz.hasmartedu.com/oapi/department/search

Query参数:

参数 类型 必填 说明
access_token string 接口调用凭证

Body参数:

参数 类型 必须 说明
name string 名称关键字
is_name_fuzzy int32 是否模糊搜索,0表示精确搜索,1表示模糊搜索
code string 部门唯一code
parentid uint32 上级部门ID

返回参数:

参数 类型 说明
errcode int32 返回码
errmsg string 对返回码的文本描述内容
total uint32 返回部门列表长度
departments 搜索部门结果列表
departments.id uint32 部门id
departments.name string 部门名称

请求示例:

GET https://jz.hasmartedu.com/oapi/department/search?access_token=ACCESS_TOKEN

请求包体:

{
  "name": "教务处",
  "is_name_fuzzy": 0,
  "code": "1009697_2_448978",
  "parentid": 1
}

返回包体:

{
    "errcode": 0,
    "errmsg": "ok",
    "departments": [
        {
            "id": 5188161,
            "name": "教务处"
        }
    ],
    "total": 1
}

用户查询可见部门

使用场景: 用于用户查询可见部门

权限说明

权限项 说明 备注
应用是否需要申请白名单 不需要
用户凭证 支持
机构凭证 不支持 -

请求方式: GET(HTTPS

请求地址: https://jz.hasmartedu.com/oapi/common/department/visible

Query参数:

参数 类型 必填 说明
access_token string 接口调用凭证

返回参数:

参数 类型 说明
errcode int32 返回码
errmsg string 对返回码的文本描述内容
departments []uint32 可见部门的id列表 (注意:返回的部门id,如果有子孙部门,它的子孙部门也是该用户可见的)

请求示例:

GET https://jz.hasmartedu.com/oapi/common/department/visible?access_token=ACCESS_TOKEN

返回包体:

{
    "errmsg": "ok",
    "errcode": 0,
    "departments": [
        8248625,
        7174490
    ]
}

获取职务列表

使用场景: 用于获取机构的职务列表

权限说明

权限项 说明 备注
应用是否需要申请白名单 不需要
用户凭证 未支持
机构凭证 支持 获取不到用户凭证的后台管理场景使用

请求方式: GET(HTTPS

请求地址: https://jz.hasmartedu.com/oapi/corp/title/list

Query参数:

参数 类型 必填 说明
access_token string 接口调用凭证

返回参数:

参数 类型 说明
errcode int32 返回码
errmsg string 对返回码的文本描述内容
参数 类型 说明
errcode int32 返回码
errmsg string 对返回码的文本描述内容
total int32 总数
data_list object数组 职务列表数据
data_list.id uint32 职务id
data_list.name string 职务名称
data_list.order uint32 次序值。order值越小排序越前
data_list.editable editable 是否可编辑 0-不可以 1-可以

请求示例:

GET https://jz.hasmartedu.com/oapi/corp/title/list?access_token=ACCESS_TOKEN

返回示例:

{
    "errmsg": "ok",
    "errcode": 0,
    "total": 10,
    "data_list": [
        {
            "id": 74135,
            "name": "校长",
            "order": 1,
            "editable": 1
        },
        {
            "id": 74142,
            "name": "普通教师",
            "order": 10,
            "editable": 0
        }
    ]
}

获取虚拟组列表

使用场景: 用于获取机构的虚拟组列表

权限说明

权限项 说明 备注
应用是否需要申请白名单 不需要
用户凭证 支持
机构凭证 支持 获取不到用户凭证的后台管理场景使用

请求方式: GET(HTTPS

请求地址: https://jz.hasmartedu.com/oapi/virtual_group/list

Query参数:

参数 类型 必填 说明
access_token string 接口调用凭证
id string 虚拟组ID,不传默认取虚拟组根节点
list_type string 0 只拉取本节点,1 支持拉取直属的下一层级,2 支持拉取所有子节点,默认取0
参数 类型 说明
total int32 总数
departments []object 虚拟组组列表
departments.id int32 虚拟组id
departments.name string 虚拟组名称
departments.code int32 虚拟组
departments.parentid int32 上级ID
departments.order int32 次序值。order值越小排序越前
departments.level int32 虚拟组层级
errcode int32 返回码
errmsg string 对返回码的文本描述内容

请求示例:

GET https://jz.hasmartedu.com/oapi/virtual_group/list?access_token=ACCESS_TOKEN

返回示例:

{
    "errmsg": "ok",
    "errcode": 0,
    "total": 2,
    "departments": [
        {
            "id": 8351596,
            "name": "虚拟组",
            "code": "",
            "parentid": 8351594,
            "order": 2,
            "level": 2
        },
        {
            "id": 8413107,
            "name": "abc",
            "code": "1503412_7_554621",
            "parentid": 8351596,
            "order": 1,
            "level": 3
        }
    ]
}
© 1998 - 2021 Tencent Inc. All Rights Reserved all right reserved,powered by ePaaS.更新时间: 2025-01-09 17:17:38

results matching ""

    No results matching ""

    results matching ""

      No results matching ""