JSON API » codes » codes/create

Creates a new feature code.

Input parameters

Requires authentication and the administrator or wholesale role privileges.

NameTypeDescriptionRequiredDefault value
auth_usernameStringAuthentication username.Yes
auth_passwordStringAuthentication password.Yes
codeStringFeature code to create.Yes
dtypeStringDestination type.Yes
dnumberStringDestination number.Yes
customerIntegerID of customer to create in.NoCustomer of authentication user.
descriptionStringDescription.NoEmpty string.
directInteger1 to allow callers to enter feature code in IVRs and attendant, 0 not to.No0
fax_detectInteger1 to detect faxes, 0 not to.No0
fax_dtypeStringDestination type on fax detection.NoEmpty string.
fax_dnumberStringDestination number on fax detection.NoEmpty string.
languageStringLanguage code. Empty string for default.NoEmpty string.
maximum_secondsIntegerMaximum seconds to let call run for, -1 for no limit.No-1
musicIntegerID of music class to play. 0 for default.No0
ownerIntegerID of owner. 0 for none.No0
panelInteger1 to display in control panel, 0 not to.No0
passwordStringPIN to update feature code. Empty string to forbid.NoEmpty string.
play_messageInteger1 to play message to callers, 2 to play without answering, 0 not to play.No0
recordgroupIntegerID of record group. 0 for none.No0
ringtoneStringRing tone to force. "auto-callback", "call-waiting", "delayed", "external", "forward", "hold-recall", "internal", "normal", "priority", "short", "transfer-recall", or empty string for none.NoEmpty string.
routingStringTemporary routing. "default" for default only, "timegroup_<ID>" for time group, number, or empty string for normal.NoEmpty string.
screenInteger1 to screen calls and play callerid, 2 to ask callers to record name, 3 to play file, 4 to play file and caller ID, 0 not to screen.No0
sharedInteger1 to share with all customers on system, 0 not to.No0
snameStringForce caller name. Empty string for no change.NoEmpty string.
sname_actionString"replace" to replace caller name, "prepend" to prepend", "append" to append.No"replace"
text_dtypeStringDestination type for text messages.No"none"
text_dnumberStringDestination number for text messages.NoEmpty string.
update_routingInteger1 to automatically update routing, 0 not to.No0
validationInteger1 to validate input then return, 0 for full action.No0

Responses

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

No data is returned.

Example: With required parameters

http://enswitch.example.com/api/json/codes/create/?auth_username=user;auth_password=password;code=100;dtype=phone;dnumber=1234567

{ "responses":[ { "code":"204", "key":"", "message":"OK" } ] }

Change history

VersionChanges
4.1update_routing input parameter added.
3.15text_dtype and text_dnumber input parameters added.
3.14ringtone input parameter added.
3.13Function added.