Search Specific Organizations

Search specific organization(s) from the organization list.

Request URL

GET {base_url}/{api_path}/organization/search?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.
search_value No String Search keyword.

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 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.
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/search?access_token=Q7p2OrTnB3hZkdn4i19gG8T2yHEnq2kZ&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": 21,
            "children": [
                {
                    "id": 2,
                    "name": "Tech support",
                    "parent_id": 1,
                    "order": 1,
                    "ext_number": 6,
                    "children": [
                        {
                            "id": 4,
                            "name": "666",
                            "parent_id": 2,
                            "order": 1,
                            "ext_number": 2,
                            "ext_list": [
                                66,
                                62
                            ]
                        },
                        {
                            "id": 10,
                            "name": "tst",
                            "parent_id": 2,
                            "order": 2,
                            "ext_number": 1,
                            "ext_list": [
                                39
                            ]
                        }
                    ],
                    "ext_list": [
                        77,
                        75,
                        76,
                        39,
                        66,
                        62
                    ]
                },
                {
                    "id": 3,
                    "name": "Sales",
                    "parent_id": 1,
                    "order": 2,
                    "ext_number": 1,
                    "ext_list": [
                        76
                    ]
                },
                {
                    "id": 6,
                    "name": "123",
                    "parent_id": 1,
                    "order": 3
                },
                {
                    "id": 7,
                    "name": "1pp3",
                    "parent_id": 1,
                    "order": 4
                },
                {
                    "id": 8,
                    "name": "1p99",
                    "parent_id": 1,
                    "order": 5
                }
            ],
            "ext_list": [
                38,
                41,
                57,
                59,
                60,
                61,
                58,
                63,
                64,
                65,
                77,
                75,
                76,
                39,
                66,
                62,
                89,
                90,
                91,
                92,
                93
            ]
        }
    ]
}