JSON API » plans » plans/routes/create
Creates a new rate plan route.
Input parameters
Requires authentication and the commerce 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 | |
| plan | Integer | ID of rate plan. | Yes | |
| allow | Integer | Whether to allow calls. 0 to forbid, 1 to allow, 2 to allow if time group is active, 3 to allow if timegroup is not active. | No | 1 |
| caller_prefix | String | Callerid prefix to match. Empty string for any. | No | Empty string. |
| description | String | Description. | No | Empty string. |
| media | String | Media type. "fax", "voice", or "voice_fax". | No | "voice_fax" |
| peer1 | Integer | ID of first peer to route to. 0 for default, -1 for least cost. | No | 0 |
| peer2 | Integer | ID of second peer to route to. 0 for none, -1 for least cost. | No | 0 |
| peer3 | Integer | ID of third peer to route to. 0 for none, -1 for least cost. | No | 0 |
| validation | Integer | 1 to validate input then return, 0 for full action. | No | 0 |
Responses
| Code | Description |
|---|---|
| 201 | Input passed validation. Only returned if validation=1. |
| 200 | Success. |
| 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. |
| 403 | Your rate plan does not allow this. |
Data returned
The ID of the created rate plan route.
Example: With required parameters
http://enswitch.example.com/api/json/plans/routes/create/?auth_username=user;auth_password=password;plan=2;called_prefix=011{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":{ "id":123 } }
Change history
| Version | Changes |
|---|---|
| 4.1 | prefix input parameter renamed to called_prefix. caller_prefix input parameter added. ID of the created rate plan route is returned. |
| 3.13 | Function added. |
