JSON API » routes » routes/create
Creates a new route.
Input parameters
Requires authentication and the system role privilege.
| Name | Type | Description | Required | Default value |
|---|---|---|---|---|
| auth_username | String | Authentication username. | Yes | |
| auth_password | String | Authentication password. | Yes | |
| called_prefix | String | Called prefix to match. | Yes | |
| outgroup | Integer | ID of outbound group. | Yes | |
| peer1 | Integer | ID of first peer to try. -1 for least cost. | Yes | |
| allow_plan_peers | Integer | 1 to allow rate plans to override this route, 0 not to. | No | 1 |
| called_max | Integer | Maximum length of called number to match. | No | 100 |
| called_min | Integer | Minimum length of called number to match. | No | 1 |
| caller_prefix | String | Callerid prefix to match. Empty string for any. | No | Empty string. |
| copy_costs_peer | Integer | If any of the peers have no costs for the outbound group, copy costs from the peer with this ID. 0 to disable. Has no effect for least cost peers. | No | 0 |
| description | String | Description. | No | Empty string. |
| media | String | Media type to match. "voice_fax" for voice or fax, "voice", "fax", or "message". | No | "voice_fax" |
| peer2 | Integer | ID of second peer to try. -1 for least cost. 0 for none. | No | 0 |
| peer3 | Integer | ID of third peer to try. -1 for least cost. 0 for none. | No | 0 |
| validation | Integer | 1 to validate input then return, 0 for full action. | No | 0 |
Responses
| Code | Description |
|---|---|
| 200 | Success. |
| 201 | Input passed validation. Only returned if validation=1. |
| 400 | Invalid input parameters specified. Check the key and message fields for more details. |
| 401 | The authentication details provided are invalid. |
| 402 | Your role does not allow this. |
Data returned
The ID of the created route.
Example: With required parameters
http://enswitch.example.com/api/json/routes/create/?auth_username=user;auth_password=password;called_prefix=012;outgroup=123;peer1=-1{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":{ "id":123 } }
Change history
| Version | Changes |
|---|---|
| 3.13 | Function added. |
