Rates


API for browsing, adding, editing and deleting Rates.

URLs

References

Looking up a Resource (single objects, lists and tabular data)
Creating a Resource
Updating a Resource
Deleting a Resource
Rate Schedules API
Rate Tiers API

Notes

Importing Rates

  1. Upload the file by POSTing the form with the file data to the API, which will create a Web Service Task that identifies the file and will return an Id to access it.

    Example
    POST /rates/upload

    You will receive a response indicating whether or not the upload was successful. If successful, a WebServiceTaskId > 0 will be returned.

    {
     "status": "success",
     "message": "",
     "data": {
         "WebServiceTaskId": 10037
     }
    }
    
  2. Initiate the import process by specifying the import file (represented by the WebServiceTaskId) and the Rate Plan that it should be imported into, along with the 'PurgeBeforeImports' and 'OverwriteDuplicates' settings.

    Example
    POST /rates/import/{WebServiceTaskId}

    RateImportData DTO
    {
     "WebServiceTaskId": 10037,
     "RatePlanId": 1020,
     "RatePlan": "",
     "PurgeBeforeImports": false,
     "OverwriteDuplicates": true
    }
    
  3. Poll the WebServiceTask to monitor the progress of the import to determine when it has been completed (it will be at 100%).

    See Monitoring Web Service Tasks for more information.

Rate Object

{
  "status": "success",
  "message": "",
  "data": 
{
  "RateId": 0,
  "RatePlanId": 0,
  "RatePlanName": "",
  "Origin": "",
  "MobileProfileId": 0,
  "MobileProfileName": "",
  "CallType": "ctAllCallTypes",
  "Dnis": "",
  "Ani": "",
  "CountryCode": "",
  "Npa": "",
  "Nxx": "",
  "LocalNumber": "",
  "Description": "",
  "DialingPrefix": "",
  "RouteGroupId": 0,
  "RouteGroupName": "",
  "PerCallCharge": 0,
  "PerMinuteCharge": 0,
  "BillingIncrement": 0,
  "GracePeriod": 0,
  "MinSecsBilled": 0,
  "ShortestCallAllowed": 0,
  "BillingDelay": 0,
  "Priority": 0,
  "RateType": "rtBillable",
  "PackagedBalanceIndexes": 
  [
    0,
    0,
    0,
    0,
    0
  ],
  "PackagedMinuteRates": 
  [
    0,
    0,
    0,
    0,
    0
  ],
  "User1": "",
  "User2": "",
  "User3": "",
  "User4": "",
  "User5": "",
  "User6": "",
  "User7": "",
  "User8": "",
  "User9": "",
  "User10": "",
  "RoutePath": "",
  "RateTierId": 0,
  "Number": "",
  "RateInterval": 0,
  "SpeakRateInterval": false,
  "DisconnectCharge": 0,
  "DisconnectChargeType": "dctFixedAmount",
  "DisconnectChargeCallEnd": false,
  "SpeakDisconnectCharge": false
}

Table Definition

RATES

This table defines the individual rate entries that are associated with each Rate Plan. Each entry allows you to rate calls (either inbound, outbound or both) based on where the call originated from or where the call is being placed.

Field Name Type Size Description
RATE_ID bigint 8 Primary key.
RATE_PLAN_ID int 8 Foreign key into RATE_PLANS table that references the Rate Plan associated with this entry.
ORIGIN varchar 40 Specifies the Inbound Node/Device's Origin that this Rate Plan entry will apply to.
ANI varchar 40 Specifies the ANI this entry applies to.
DNIS varchar 40 Specifies the DNIS this entry applies to.
COUNTRY_CODE varchar 8 Specifies the country code for this entry.
NPA varchar 8 Specifies the NPA (Numbering Plan Area) for this entry.
NXX varchar 8 Specifies the local number prefix for this entry.
LOCAL_NUMBER varchar 20 Specifies the local number suffix for this entry.
CALL_TYPE tinyint 1 Foreign key into the CALL_TYPES table.
MOBILE_PROFILE_ID smallint 2 Foreign key into the MOBILE_PROFILES table.
PRIORITY tinyint 1 Priority of this entry.
DESCRIPTION varchar 40 Description of this entry.
DIALING_PREFIX varchar 10 Specifies the digit(s) that should prefix the outbound dialed number.
ROUTE_GROUP_ID smallint 2 Foreign key into the ROUTE_GROUPS table that references the Route Group to use to route this call to its ultimate destination.
PER_CALL_CHARGE decimal (15,4) Specifies the amount (in dollars or units) to bill calls to the destination defined by this Rate Plan entry for each call. The amount specified here is assessed once per call and is independent of the duration of the call.
PER_MINUTE_CHARGE decimal (15,4) Specifies the amount (in dollars or units) per minute to bill calls to the destination defined by this Rate Plan entry.
BILLING_INCREMENT smallint 2 Specifies the billing increment (in seconds) for calls to the destination.
GRACE_PERIOD smallint 2 Specifies the duration (in seconds) threshold under which the user will not be Charged.
MIN_SECS_BILLED smallint 2 Specifies the minimum duration (in seconds) that a user will be billed for a call.
SHORTEST_CALL_ALLOWED smallint 2 Specifies the amount of time (in seconds) that the caller must be able to afford, or the call will not be allowed.
BILLING_DELAY smallint 2 Specifies the amount of time (in seconds) after, which the billing will be started.
PACKAGED_BALANCE_INDEX varchar 10 Comma separated list, which indicates which packaged balance(s) from the ACCOUNTS table will be used for this rate, and in which order they will be applied.
PACKAGED_MINUTE_RATE varchar 20 Comma separated list of rates at which whole minutes are deducted from the callers packaged minute balance. Rates will be applied in the same order as the entries in the PACKAGED_BALANCE_INDEX, for each corresponding packaged balance.
USER_1 varchar 50 Stores user defined information. This field will be copied to a field of the same name in the Billing table.
USER_2 varchar 50 Stores user defined information. This field will be copied to a field of the same name in the Billing table.
USER_3 varchar 50 Stores user defined information. This field will be copied to a field of the same name in the Billing table.
USER_4 varchar 50 Stores user defined information. This field will be copied to a field of the same name in the Billing table.
USER_5 varchar 50 Stores user defined information. This field will be copied to a field of the same name in the Billing table.
USER_6 varchar 50 Stores user defined information. This field will be copied to a field of the same name in the Billing table.
USER_7 varchar 50 Stores user defined information. This field will be copied to a field of the same name in the Billing table.
USER_8 varchar 50 Stores user defined information. This field will be copied to a field of the same name in the Billing table.
USER_9 varchar 50 Stores user defined information. This field will be copied to a field of the same name in the Billing table.
USER_10 varchar 50 Stores user defined information. This field will be copied to a field of the same name in the Billing table.
RATE_TYPE tinyint 1 Specifies the type of rate entry, such as Billable, Blocked or No Charge. See the RATE_TYPES table.
RATE_TIER_ID int 4 Foreign key into the RATE_TIERS table that references the Rate Tier associated with this entry.
NUMBER varchar 45 Computed column used for lookups. For internal use only.
RATE_INTERVAL tinyint 1 Rate interval to use for billing purposes (default: 60 seconds).
SPEAK_RATE_INTERVAL bit 1 Sets whether the rate interval is to be used when calculating the number of minutes available to speak to the caller.
DISCONNECT_CHARGE decimal (15,4) The disconnect charge (amount or percentage) to bill the caller.
DISCONNECT_CHARGE_TYPE tinyint 1 Sets how the disconnect charge is applied (i.e. 0=Fixed amount, 1=Percentage (%)).
DISCONNECT_CHARGE_CALL_END bit 1 When set, specifies that the disconnect charge is applied at the end of the call.
SPEAK_DISCONNECT_CHARGE bit 1 Sets whether the disconnect charge is used when calculating the number of minutes available to speak to the caller.