JSON API » plans » plans/routes/create

Creates a new rate plan route.

Input parameters

Requires authentication and the commerce role privilege.

NameTypeDescriptionRequiredDefault value
auth_usernameStringAuthentication username.Yes
auth_passwordStringAuthentication password.Yes
called_prefixStringCalled prefix to match.Yes
planIntegerID of rate plan.Yes
allowIntegerWhether 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.No1
caller_prefixStringCallerid prefix to match. Empty string for any.NoEmpty string.
descriptionStringDescription.NoEmpty string.
mediaStringMedia type. "fax", "voice", or "voice_fax".No"voice_fax"
peer1IntegerID of first peer to route to. 0 for default, -1 for least cost.No0
peer2IntegerID of second peer to route to. 0 for none, -1 for least cost.No0
peer3IntegerID of third peer to route to. 0 for none, -1 for least cost.No0
validationInteger1 to validate input then return, 0 for full action.No0

Responses

CodeDescription
201Input passed validation. Only returned if validation=1.
200Success.
400Invalid input parameters specified. Check the key and message fields for more details.
401The authentication details provided are invalid.
402Your role does not allow this.
403Your 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

VersionChanges
4.1prefix input parameter renamed to called_prefix. caller_prefix input parameter added. ID of the created rate plan route is returned.
3.13Function added.