Accounts API

Update Needed

We recently noticed that there isn’t a METHOD explained on how to create an account, only READ, UPDATE and DELETE. So we will be updating this documentation shortly to reflect a CREATE METHOD as well.

URI

v1/accounts/{account_id}

 

Base Parameters

Property
Description
Validation
Modifiable
name A friendly name for the account required yes
realm realm of the account, ie: ‘account1.avpnet.us’ unique, required yes
caller_id The Caller ID Parameters object yes
caller_id_options The Caller ID Option Parameters object yes
vm_to_email_template The Voicemail To Email Template string yes
trunks How many two-way trunks the account has non-negative integer yes
inbound_trunks How many inbound-only trunks the account has non-negative integer yes
external_api_keys External API keys storage object yes

Operations

Verb

Accepted

Returned

Description

GET

 

ALL

Fetch the details of an account

POST

ANY

ALL

Update the parameters of an account

DELETE

 

 

Delete the account

Response Codes

Normal Response Code(s): 200, 201

Error Response Code(s): 400, 401, 404, 415, 500, 503, 504


Component Parameters

Caller ID Parameters

Property

Description

Validation

Modifiable

name

The name to provide as the caller id

 

yes

number

The number to provide as the caller id

 

yes

The property names of the caller-id objects represent the caller-id type. Whistle will use ‘internal’ and ‘external’ when appropriate and if no ‘caller_id_type’ overrides these parameters, when overridden any arbitrary value may be supplied. The caller-id on the account definition is used if no other caller-id specifications have a matched the type. Furthermore, the account caller-id is the only one that can define a type of ‘default’ that is used when no other match has been found, including the account’s own caller-id parameters.

Caller ID Option Parameters

Property

Description

Validation

Modifiable

reformat

A regular expression that if matched internal caller id numbers are replaced by

 

yes

Caller-id option parameters are hierarchal following the same hunt order as caller-id parameters.

 

You need to escape backslashes in literal strings with an additional backslash in the regular expressions.

 

 

If the caller-id option “reformat” has multiple matching groups, then the group that creates the largest number of characters will be used.

 

Voicemail To Email Template

When an email is sent with a new voicemail attached, the format of the plaintext body is configurable.

The default template is:

 

“New Voicemail Message\n\nCaller ID: {{caller_id_number}}\nCaller Name: {{caller_id_name}}\n\nCalled To: {{to_user}}   (Originally dialed number)\nCalled On: {{date_called|date:\”l, F j, Y \\a\\t H:i\”}}\n\n\nFor help or questions using your phone or voicemail, please contact support at {{support_number}} or email {{support_email}}”

 

The templating language used is the Django templating system. Below are the currently available values that can be inserted:

Name

Type of Value

Configurable

caller_id_number

E.164 formatted number (if possible)

no

caller_id_name

String

no

to_user

E.164 formatted number (if possible)

no

date_called

timestamp (in UTC)

no

date_called_local

timestamp (user’s configured Timezone (or UTC))

no

support_number

String

yes

support_email

String

yes

External API keys storage

Stores API keys from external service providers like Amazon, Rackspace.

Name

Type of Value

User-provided

rackspace

String

yes

linode

String

yes

amazon

String

yes

Using Accounts API

GET METHOD

v1/accounts/{account_id}

X-Auth-Token: abc123 Accept: application/json

{ "auth_token":"abc123", "status":"success", "data":{ "name":"Company, Inc.", "realm":"asd123a.avpnet.us", "caller_id":{ "default":{ "number":"5555555555", "name": "Company Inc" }, "internal":{ "name": "HAVE OPS SET YOUR CID" } } } }

200 OK

DELETE METHOD

}’ tab_head_4=’Response Header’ tab_content_4=’200 OK’ id=”” class=”” style=”” ]

POST METHOD

v1/accounts/{account_id}

X-Auth-Token: abc123 Accept: application/json Content-Type: application/json

{ "data":{ "name":"Company Inc", "realm":"defsa11.avpnet.us", "caller_id":{ "default":{ "number":"5555555555", "name": "Company Inc" }, "internal":{ "name": "HAVE OPS SET YOUR CID" }, "emergency":{ "number":"5555555551", "name": "Company Inc" } } } }

Updated on June 19, 2017

Was this article helpful?

Not the solution you were looking for?
Click the link below to submit a support ticket
Submit Ticket

Leave a Comment