Accounts

Accounts and sub-accounts are useful for things like segmenting phone numbers and usage data for your users and controlling access to data.

Account Resource URI

/2012-04-24/Accounts/{AccountSid}

Resource Properties

Property Description

Sid

A string that uniquely identifies this account.

DateCreated

The date that this account was created.

DateUpdated

The date that this account was last updated.

FriendlyName

A description of this account, up to 64 characters long. By default the FriendlyName is your email address.

Status

The status of this account. Possible values are active, suspended, and closed.

AuthToken

The authorization token for this account. This should not be shared.

Uri

The URI for this account, relative to https://localhost:port/restcomm.

Supported Operations

HTTP GET. Returns the representation of an Account resource, including the properties above.

  • Account Resource URI. /2012-04-24/Accounts/{EmailAddress}

HTTP POST/PUT. Modifies an Account resource and returns the representation, including the properties above. Below you will find a list of optional parameters.

Request Parameters

Parameter Description

FriendlyName

A description of this account, up to 64 characters long.

Status

The status of this account. Possible values are active, suspended, and closed.

Password

A password that will be used to generate the AuthToken for the new Account resource.

Account Migration to new Organization

Account Migration operation can be used to migrate a top level account to a new organization. In the process, all child accounts will also be migrated.

  • Account Migration Resource URI /2012-04-24/Accounts/migrate/{AccountSid}

  • Method HTTP POST

  • The operation is allowed for Super Admin only

  • The account to migrate must be a top level account (child of Super Admin)

Request Parameters

Parameter Description

Organization

The new Organization SID or Domain Name to move the account. Required

Response Status

Status Description

200 OK

Migration operation completed successfully

403 Forbidden

Only Super Admin is allowed for the migrate operation

412 Precondition Failed

Target Organization SID or Domain Name is missing

404 Not Found

Target Account SID is missing

400 Bad Request

Target Account is not a top level account or target account is already in the new organization

Get information about the default account.

curl -X GET  https://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf

Change default account password(AuthToken).

To update an account you need to provide the SID of the account or the email address of the account (make sure you url escape the @ sign of the email address)

For example, update password using account sid:

curl -X PUT https://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf -d "Password=NewPassword"

And update password using email address of the account:

curl -X PUT https://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/administrator%40company.com -d "Password=NewPassword"
The above command uses the Account SID of the requestor, and the one below uses the Email Account. Note the administrator%40company.com is used instead of administrator@company.com . This is because using curl on the bash terminal doesn’t parse the @ correctlyl. If you were to running on a browser, you can safely use the @ as the web browser will correctly handle it.
curl -X GET  https://administrator%40company.com:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf

The above commands will print an output similar to the one below:

<RestcommResponse>
  <Account>
    <Sid>ACae6e420f425248d6a26948c17a9e2acf</Sid>
    <FriendlyName>Default Administrator Account</FriendlyName>
    <Status>active</Status>
    <Type>Full</Type>
    <DateCreated>2012-04-24T00:00:00.000-06:00</DateCreated>
    <DateUpdated>2012-04-24T00:00:00.000-06:00</DateUpdated>
    <AuthToken>77f8c12cc7b8f8423e5c38b035249166</AuthToken>
    <Uri>/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf</Uri>
    <SubresourceUris>
      <AvailablePhoneNumbers>/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/AvailablePhoneNumbers</AvailablePhoneNumbers>
      <Calls>/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls</Calls>
      <Conferences>/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Conferences</Conferences>
      <IncomingPhoneNumbers>/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/IncomingPhoneNumbers</IncomingPhoneNumbers>
      <Notifications>/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Notifications</Notifications>
      <OutgoingCallerIds>/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/OutgoingCallerIds</OutgoingCallerIds>
      <Recordings>/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Recordings</Recordings>
      <Sandbox>/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Sandbox</Sandbox>
      <SMSMessages>/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/SMS/Messages</SMSMessages>
      <Transcriptions>/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Transcriptions</Transcriptions>
    </SubresourceUris>
  </Account>

Account List Resource

  • Account List Resource URI. /2012-04-24/Accounts

Supported Operations

HTTP GET. Returns the list representation of all the Sub-Account resources for this Account, including the properties above.

HTTP POST. Creates a new Sub-Account and returns the representation of the Sub-Account resource, including the properties above. Below you will find a list of required and optional parameters.  

Request Parameters

Parameter Description

EmailAddress(Required)

The email address to use for this account.

FriendlyName

A description of this account, up to 64 characters long. Default, is your email address.

Status

The status of this account. Default is active, possible values are active, suspended, and closed.

Password(Required)

A password that will be used to generate the AuthToken for the new Account resource.

Role(Required)

The security role that this Account resource will use. If no role is provided then the role of the account resource creating this will be inherited to the new Account resource and may compromise the system.

Sub-Accounts

You can read more about Sub-Accounts and Multi-tenancy HERE

curl -X GET https://[primarySid]:[primaryAuthToken]@127.0.0.1:8080/restcomm/2012-04-24/Accounts/[secondarySid]/

Get a list of all current accounts

curl -X GET https://[primarySid]:[primaryAuthToken]@127.0.0.1:8080/restcomm/2012-04-24/Accounts/

Here is an example of how to createa a sub-account. The sub-account will inherit the same permissions has the Administrator’s account.

curl -X POST https://administrator%40company.com:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ -d "FriendlyName=MySubAccount" -d "EmailAddress=test@telestax.com" -d "Password=restcomm"

Supported Operations

the SID, Email and the AuthToken (see output below) of the sub-account can now be used instead of the Administrator’s account  
<RestcommResponse>
  <Account>
    <Sid>AC3b8f0dd2e5026abde018446cbb3b185d</Sid>
    <FriendlyName>MySubAccount</FriendlyName>
    <Status>active</Status>
    <Type>Full</Type>
    <DateCreated>2013-10-16T09:22:28.708-06:00</DateCreated>
    <DateUpdated>2013-10-16T09:22:28.712-06:00</DateUpdated>
    <AuthToken>53134d7a9914e2b47c8435ebdb50ded3</AuthToken>
    <Uri>/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d</Uri>
    <SubresourceUris>
      <AvailablePhoneNumbers>/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d/AvailablePhoneNumbers</AvailablePhoneNumbers>
      <Calls>/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d/Calls</Calls>
      <Conferences>/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d/Conferences</Conferences>
      <IncomingPhoneNumbers>/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d/IncomingPhoneNumbers</IncomingPhoneNumbers>
      <Notifications>/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d/Notifications</Notifications>
      <OutgoingCallerIds>/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d/OutgoingCallerIds</OutgoingCallerIds>
      <Recordings>/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d/Recordings</Recordings>
      <Sandbox>/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d/Sandbox</Sandbox>
      <SMSMessages>/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d/SMS/Messages</SMSMessages>
      <Transcriptions>/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d/Transcriptions</Transcriptions>
    </SubresourceUris>
  </Account>

Close Sub-Accounts

JSON Account Closing
curl -X PUT https://ACae6e420f425248d6a26948c17a9e2acf:PWD@127.0.0.1:8080/restcomm/2012-04-24/Accounts.json/AC3b8f0dd2e5026abde018446cbb3b185d -d "Status=closed"
XML Account Closing
curl -X PUT https://ACae6e420f425248d6a26948c17a9e2acf:PWD@127.0.0.1:8080/restcomm/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d -d "Status=closed"

The command above will close an account permanently. When an account is closed access to the system through it is revoked and most of its resources are deleted. The actual account entity will remain present though.

Delete Sub-Accounts (deprecated)

XML Account Deletion
curl -X DELETE https://ACae6e420f425248d6a26948c17a9e2acf:PWD@192.168.1.3:8080/restcomm/2012-04-24/Accounts/<Sub-Account-SID>
JSON Account Deletion
curl -X DELETE https://ACae6e420f425248d6a26948c17a9e2acf:PWD@192.168.1.3:8080/restcomm/2012-04-24/Accounts.json/<Sub-Account-SID>.json
Account deletion has been deprecated from the REST API. Both of these methods will return HTTP 405. You will need to close the account instead.