switchvox.extensions.phones.bulk.upload
From SwitchvoxExtendAPI
Contents |
Description
Uploads CSV file to add new SIP or Virtual extensions to the system in bulk. Must be called by posting the request and file to the /xml handler.
Arguments
- See the Constructing Requests page to learn how to use arguments in requests.
| Name | Required | Type | Default | Description |
| csv_file | required | file | CSV file containing the information about the extensions to create. | |
| extension_type | required | string | The type for the new extensions to be created. Only sip and virtual are valid. | |
| dupe_process | required | integer | How the handle an existing extension. (1 = skip, 2 = replace, 3 = update). | |
| template_account_id | required | integer | ID of the extension template to use for the extensions that will be created. | |
| report_only | required | integer | 0 | By default this function will create the extensions in the file. Pass in 1 for this value if you only want a report on what would happen if the csv file is processed. |
Example Requests & Responses
- Please see the API Request and Response Format section for more information on various request encodings.
Example One
Request
Post a CSV file and create SIP extensions using the default template and skipping any duplicate extensions.
Simple Example: POST /xml HTTP/1.1 Content-Type: multipart/form-data; boundary=---------------------------7d44e178b0434 Host: pbx.fourloop.com Content-Length: 35261 -----------------------------7d44e178b0434 Content-Disposition: form-data; name="request" <request method="switchvox.extensions.phones.bulk.upload"> <parameters> <dupe_process>1</dupe_process> <extension_type>sip</extension_type> <template_account_id>1</template_account_id> </parameters> </request> -----------------------------7d44e178b0434 Content-Disposition: form-data; name="csv_file"; filename="C:\extensions.csv" Content-Type: image/jpeg {CSV FILE} -----------------------------7d44e178b0434—
Response
A report on the creation process is returned
<response method="switchvox.extensions.phones.bulk.upload"> <result> <bulk_creation_report dupe_process="1" extension_type="SIP Extension"> <create_failed> <extension extension="301" first_name="Joey" last_name="Johnson" email="jjohn@test.com"> <error text="Phone password is required to create a sip extension."/> </extension> <extension extension="304" first_name="" last_name="last" email="last@test.com"> <error text="First name is required and must be 1 - 32 characters in length."/> <error text="Phone password cannot be the same as the extension."/> </extension> </create_failed> <created> <extension extension="302" first_name="Freddy" last_name="Mercury" email="fmerc@test.com"/> <extension extension="303" first_name="John" last_name="Doe" email="jdoe@test.com"/> <extension extension="305" first_name="Mike" last_name="Mitchell" email="mmitch@test.com"/> </created> <replaced></replaced> <updated></updated> <skipped></skipped> </bulk_creation_report> </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 |
| 86161 | Your phone system has not yet been registered and is limited to %1 extensions. |
| 86162 | You have exceeded the number of phone extensions available for your PBX. Please contact your reseller to purchase more extensions. |
| 86173 | Invalid template account ID (%1) |
| 61987 | Invalid extension type. Only SIP and Virtual extensions can be created in bulk. |
| 95106 | Invalid dupe process (%1). Valid options are: 1 (Skip), 2 (Replace), and 3 (Update). |
| 96463 | The extension_array parameter is not an array. |
| 38297 | Error getting template values for template with id %1. |
| 94772 | Your CSV file is not in the correct format. Please see the help link next to the Extension File input for more information. |
| 70674 | Problems uploading your CSV file. |
| 51132 | Your CSV file contained no extension data. |
| 32334 | Error creating temporary file for bulk extension creation. |