switchvox.extensions.search
From SwitchvoxExtendAPI
Contents |
Description
Searches all the extensions on a system and returns simple information about each extension that matches the search criteria. If you have a single extension number or an account_id and need extension information then you should use switchvox.extensions.getInfo.
Arguments
- See the Constructing Requests page to learn how to use arguments in requests.
| Name | Required | Type | Default | Description |
| min_extension | optional | string | Minimum extension number. | |
| max_extension | optional | integer | Maximum extension number. If both min/max extension is provided, the max must be greater than the min. | |
| extension_types extension_type |
optional | string | A list of extension types to filter by. See Extension Types for a list of possible values. | |
| min_create_date | optional | date | Minimum creation date of extension. Extensions with a create date greater than or equal to this value will be returned. The date should be in the format YYYY-MM-DD HH:MM:SS | |
| max_create_date | optional | date | Maximum creation date of extension. Extensions with a create date less than or equal to this value will be returned. The date should be in the format YYYY-MM-DD HH:MM:SS. If both dates are provided, the max must be greater than the min. | |
| sort_field | optional | string | number | The field on which to sort the returned extensions. Possible values: number, display, account_id, extension_type and date_created. |
| sort_order | optional | string | ASC | The order in which to sort returned extensions. Possible values: ASC and DESC. |
| items_per_page | optional | integer | 50 | Number of extensions to return per page. |
| page_number | optional | integer | 1 | The page number of extensions to return. |
Example Requests & Responses
- Please see the API Request and Response Format section for more information on various request encodings.
Request
Requests a list of all the SIP,Analog,and Virtual extensions on the system.
<request method="switchvox.extensions.search"> <parameters> <extension_types> <extension_type>sip</extension_type> <extension_type>zap</extension_type> <extension_type>virtual</extension_type> </extension_types> <items_per_page>500</items_per_page> </parameters> </request>
Response
<response method="switchvox.extensions.search"> <result> <extensions page_number="1" total_pages="1" items_per_page="500" total_items="2"> <extension number="601" status="1" can_dial_from_ivr="1" account_id="1122" display="Thomas Jones" date_created="2009-01-28 21:34:29" type="virtual" type_display="Virtual Extension" first_name="Thomas" last_name="Jones" email_address="" template_id="1" template_name="Default" /> <extension number="405" status="1" can_dial_from_ivr="1" account_id="1135" display="David Podolsky" date_created="2009-02-09 16:00:23" type="sip" type_display="SIP Extension" first_name="David" last_name="Podolsky" email_address="dwp@fourloop.com" template_id="1" template_name="Default" /> </extensions> </result> </response>
Error Codes
- See the Error Code Formatting section to see the xml structure when an error is returned.
- See the Generic Error Codes section to see a list of general fault codes that may be returned.
| Code | Description |
| 77534 | Invalid date (%1). Date and time format is (YYYY-MM-DD HH:MM:SS). |
| 75429 | Invalid date (%1). February 29th is outside a leap year. |
| 63014 | Invalid date (%1). February 30th and 31st do not exist. |
| 25673 | Invalid date (%1). You selected the 31st of a month with only 30 days. |
| 12010 | The 'To Date' is before your 'From Date'. |
| 12016 | Invalid sort field. |
| 12017 | Invalid sort order. |
| 12018 | items_per_page may only contain digits |
| 12019 | page_number may only contain digits |
| 83950 | min_extension may only contain digits |
| 54237 | max_extension may only contain digits |
| 74609 | fax_extension must be larger than min_ext |
| 74609 | Invalid extension_type (%INPUT) |