查询部门列表

查询部门列表信息。

请求 URL

GET {base_url}/{api_path}/organization/list?access_token={access_token}

请求参数

1.
参数 是否必填 类型 说明
page Integer 定义显示第几个页面。
page_size Integer 定义每页显示几项查询结果。
sort_by String 定义排序字段。

取值范围id

order_by String 定义显示顺序。

取值范围

  • asc:升序
  • desc:降序
is_all Integer 是否返回完整信息。

取值范围

  • 0:返回包含分机统计数据的部门信息。
  • 1:返回包含分机统计数据和分机列表的部门信息。
  • 2:仅返回部门信息。

响应参数

2.
参数 类型 说明
errcode Integer 返回错误码。
  • 0:请求成功。
  • 非零值:请求失败。
注: 更多错误码和错误信息说明,请参见 错误码 & 错误信息
errmsg String 返回信息。
  • SUCCESS:请求成功。
  • FAILURE:请求失败。
organization_list Array<Organization_List> 部门信息。
Organization_List
3.
参数 类型 说明
id Integer 部门的唯一 ID。
name String 部门名称。
parent_id Integer 父部门的唯一 ID。
order Integer 部门序号。
ext_number Integer 部门中包含的分机总数。
注: 此参数仅在 is_all 参数值为 01 时返回。
children Array<Sub_Organization> 子部门信息。
ext_list Array<Integer> 部门中包含的分机列表。
注: 此参数仅在 is_all 参数值为 1 时返回。
Sub_Organization
4.
参数 类型 说明
id Integer 部门的唯一 ID。
name String 部门名称。
parent_id String 父部门的唯一 ID。
order String 部门序号。
ext_number String 部门中包含的分机总数。
注: 此参数仅在 is_all 参数值为 01 时返回。
children Array<Sub_Organization> 子部门信息。
ext_list Array<Integer> 部门中包含的分机列表。
注: 此参数仅在 is_all 参数值为 1 时返回。

示例

请求示例

GET /openapi/v1.0/organization/list?access_token=GseU7IyuT2nxJQ8NfReyF24rdknvVrOm&is_all=1 HTTP/1.1  
Host: 192.168.5.150:8088

响应示例

HTTP/1.1 200 OK
{
    "errcode": 0,
    "errmsg": "SUCCESS",
    "organization_list": [
        {
            "id": 1,
            "name": "Yeastar",
            "parent_id": 0,
            "order": 1,
            "ext_number": 17,
            "children": [
                {
                    "id": 12,
                    "name": "Marketing Center",
                    "parent_id": 1,
                    "order": 1,
                    "ext_number": 14,
                    "children": [
                        {
                            "id": 17,
                            "name": "Tech Support",
                            "parent_id": 12,
                            "order": 1,
                            "ext_number": 8,
                            "ext_list": [
                                75,
                                76,
                                39,
                                77,
                                62,
                                63,
                                65,
                                66
                            ]
                        },
                        {
                            "id": 18,
                            "name": "Training Team",
                            "parent_id": 12,
                            "order": 2,
                            "ext_number": 3,
                            "ext_list": [
                                38,
                                41,
                                57
                            ]
                        },
                        {
                            "id": 13,
                            "name": "Marketing Team",
                            "parent_id": 12,
                            "order": 3,
                            "ext_number": 3,
                            "ext_list": [
                                59,
                                60,
                                61
                            ]
                        }
                    ],
                    "ext_list": [
                        75,
                        76,
                        39,
                        77,
                        62,
                        63,
                        65,
                        66,
                        38,
                        41,
                        57,
                        59,
                        60,
                        61
                    ]
                },
                {
                    "id": 15,
                    "name": "Research & Development Center",
                    "parent_id": 1,
                    "order": 2,
                    "ext_number": 3,
                    "children": [
                        {
                            "id": 21,
                            "name": "Test",
                            "parent_id": 15,
                            "order": 1,
                            "ext_number": 1,
                            "ext_list": [
                                90
                            ]
                        }
                    ],
                    "ext_list": [
                        58,
                        64,
                        90
                    ]
                }
            ],
            "ext_list": [
                75,
                76,
                39,
                77,
                62,
                63,
                65,
                66,
                38,
                41,
                57,
                59,
                60,
                61,
                58,
                64,
                90
            ]
        }
    ]
}