Query Organization List

Query the organization list.

Request URL

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

Request parameters

Table 1.
Parameter Required Type Description
page No String Define which page is displayed.
page_size No String Define how many records per page.
sort_by No String Define the sorting field.

Valid value: id.

order_by No String Define the display order.

Valid value:

  • asc: Ascending order.
  • desc: Descending order.
is_all No Integer Whether to return the complete information.

Valid value:

  • 0: Return the organization information, including the statistics of extensions.
  • 1: Return the complete organization information, including the statistics and list of extensions.
  • 2: Return the organization information only.

Response parameters

Table 2.
Parameter Type Description
errcode Integer Returned error code.
  • 0: Succeed.
  • Non-zero value: Failed.
Note: You can check the error code and error message in Error Code and Error Message.
errmsg String Returned message.
  • SUCCESS: Succeed.
  • FAILURE: Failed.
organization_list Array<Organization_List> The information of the organization.
Organization_List
Table 3.
Parameter Type Description
id Integer Organization ID.
name String Organization name.
parent_id Integer Parent organization ID.
order Integer The sequence number of the organization.
ext_number Integer The total number of extensions that are included in the organization.
Note: This parameter is only returned when the value of is_all is 0 or 1.
children Array<Sub_Organization> The information of the sub-organization.
ext_list Array<Integer> The ID list of the extensions that are included in the organization.
Note: This parameter is only returned when the value of is_all is 1.
Sub_Organization
Table 4.
Parameter Type Description
id Integer Organization ID.
name String Organization name.
parent_id String Parent organization ID.
order String The sequence number of the organization.
ext_number String The total number of extensions that are included in the organization.
Note: This parameter is only returned when the value of is_all is 0 or 1.
children Array<Sub_Organization> The information of the sub-organization.
ext_list Array<Integer> The ID list of the extensions that are included in the organization.
Note: This parameter is only returned when the value of is_all is 1.

Examples

Request example

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

Response example

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
            ]
        }
    ]
}