JSON API » routes » routes/create

Creates a new route.

Input parameters

Requires authentication and the system role privilege.

NameTypeDescriptionRequiredDefault value
auth_usernameStringAuthentication username.Yes
auth_passwordStringAuthentication password.Yes
called_prefixStringCalled prefix to match.Yes
outgroupIntegerID of outbound group.Yes
peer1IntegerID of first peer to try. -1 for least cost.Yes
allow_plan_peersInteger1 to allow rate plans to override this route, 0 not to.No1
called_maxIntegerMaximum length of called number to match.No100
called_minIntegerMinimum length of called number to match.No1
caller_prefixStringCallerid prefix to match. Empty string for any.NoEmpty string.
copy_costs_peerIntegerIf 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.No0
descriptionStringDescription.NoEmpty string.
mediaStringMedia type to match. "voice_fax" for voice or fax, "voice", "fax", or "message".No"voice_fax"
peer2IntegerID of second peer to try. -1 for least cost. 0 for none.No0
peer3IntegerID of third peer to try. -1 for least cost. 0 for none.No0
validationInteger1 to validate input then return, 0 for full action.No0

Responses

CodeDescription
200Success.
201Input passed validation. Only returned if validation=1.
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.

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

VersionChanges
3.13Function added.