Replace obsoleted API documentation with link towards godoc

This commit is contained in:
DanB
2017-05-12 14:41:03 +02:00
parent e3be7f9016
commit 377d24d3ca
17 changed files with 2 additions and 2843 deletions

View File

@@ -1,56 +0,0 @@
ApierV1.SetAccountActions
+++++++++++++++++++++++++
Process dependencies and load a specific AccountActions profile from storDb into dataDb.
**Request**:
Data:
::
type AttrSetAccountActions struct {
TPid string
AccountActionsId string
}
Mandatory parameters: ``[]string{"TPid", "AccountActionsId"}``
*JSON sample*:
::
{
"id": 0,
"method": "ApierV1.SetAccountActions",
"params": [
{
"AccountActionsId": "AA_1005",
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
string
Possible answers:
``OK`` - Success.
*JSON sample*:
::
{
"error": null,
"id": 0,
"result": "OK"
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.

View File

@@ -1,68 +0,0 @@
Cache APIs
==========
Set of cache related APIs.
ApierV1.ReloadCache
-------------------
Used to enforce a cache reload. It can be fine tuned to reload individual destinations and rating plans. In order to reload all destinations and/or rating plans, one can use empty list or null values instead.
**Request**:
Data:
::
type ApiReloadCache struct {
DestinationIds []string
RatingPlanIds []string
RatingProfileIds []string
ActionIds []string
}
Mandatory parameters: none
*JSON sample*:
::
{
"id": 1,
"method": "ApierV1.ReloadCache",
"params": [
{
"DestinationIds": [
"GERMANY",
"GERMANY_MOBILE",
"FS_USERS"
],
"RatingPlanIds": [
"RETAIL1"
]
}
]
}
**Reply**:
Data:
::
string
Possible answers:
* *OK*
*JSON sample*:
::
{
"error": null,
"id": 1,
"result": "OK"
}
**Errors**:
``SERVER_ERROR`` - Server error occurred.

View File

@@ -1,65 +0,0 @@
CDR APIs
========
Set of CDR related APIs.
ApierV1.ExportCsvCdrs
---------------------
Used to request a new CDR export file. In can include specific interval for CDRs *answer_time*. Any of the two interval limits can be left unspecified hence resulting in the possibility to export complete database of CDRs with one API call.
*NOTE*: Since CGRateS does not keep anywhere a history of exports, it becomes the responsibility of the system administrator to make sure that his exports are not doubled.
**Request**:
Data:
::
type AttrExpCsvCdrs struct {
TimeStart string // If provided, will represent the starting of the CDRs interval (>=)
TimeEnd string // If provided, will represent the end of the CDRs interval (<)
}
Mandatory parameters: none
*JSON sample*:
::
{
"id": 3,
"method": "ApierV1.ExportCsvCdrs",
"params": [
{
"TimeEnd": "1383823746"
}
]
}
**Reply**:
Data:
::
type ExportedCsvCdrs struct {
ExportedFilePath string // Full path to the newly generated export file
NumberOfCdrs int // Number of CDRs in the export file
}
*JSON sample*:
::
{
"error": null,
"id": 3,
"result": {
"ExportedFilePath": "/var/log/cgrates/cdr/out/cgr/csv/cdrs_1384104724.csv",
"NumberOfCdrs": 2
}
}
**Errors**:
``SERVER_ERROR`` - Server error occurred.

View File

@@ -1,57 +0,0 @@
ApierV1.SetRatingProfile
++++++++++++++++++++++
Process dependencies and load a specific rating profile from storDb into dataDb.
**Request**:
Data:
::
type AttrSetRatingProfile struct {
TPid string
RatingProfileId string
}
Mandatory parameters: ``[]string{"TPid", "RatingProfileId"}``
*JSON sample*:
::
{
"id": 37,
"method": "ApierV1.SetRatingProfile",
"params": [
{
"RatingProfileId": "RP_ANY",
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
string
Possible answers:
``OK`` - Success.
*JSON sample*:
::
{
"error": null,
"id": 37,
"result": "OK"
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.

View File

@@ -1,54 +0,0 @@
Scheduler APIs
==============
Set of scheduler related APIs.
ApierV1.ReloadScheduler
-----------------------
When called CGRateS will reorder/reschedule tasks based on data available in dataDb. This command is necessary after each data load, in some cases being automated in the administration tools (eg: inside *cgr-loader*)
**Request**:
Data:
::
string
Mandatory parameters: none
*JSON sample*:
::
{
"id": 0,
"method": "ApierV1.ReloadScheduler",
"params": [
""
]
}
**Reply**:
Data:
::
string
Possible answers: **OK**
*JSON sample*:
::
{
"error": null,
"id": 0,
"result": "OK"
}
**Errors**:
``SERVER_ERROR`` - Server error occurred.

View File

@@ -1,49 +0,0 @@
ApierV1.GetTPIds
++++++++++++++++
Queries tarrif plan identities gathered from all tables.
**Request**:
Data:
::
type AttrGetTPIds struct {
}
*JSON sample*:
::
{
"id": 9,
"method": "ApierV1.GetTPIds",
"params": []
}
**Reply**:
Data:
::
[]string
*JSON sample*:
::
{
"error": null,
"id": 9,
"result": [
"SAMPLE_TP",
"SAMPLE_TP_2"
]
}
**Errors**:
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - No tariff plans defined.

View File

@@ -1,197 +0,0 @@
ApierV1.SetTPAccountActions
+++++++++++++++++++++++++
Creates a new AccountActions profile within a tariff plan.
**Request**:
Data:
::
type ApiTPAccountActions struct {
TPid string // Tariff plan id
AccountActionsId string // AccountActions id
Tenant string // Tenant's Id
Account string // Account name
Direction string // Traffic direction
ActionTimingsId string // Id of ActionTimings profile to use
ActionTriggersId string // Id of ActionTriggers profile to use
}
Mandatory parameters: ``[]string{"TPid", "AccountActionsId","Tenant","Account","Direction","ActionTimingsId","ActionTriggersId"}``
*JSON sample*:
::
{
"id": 48,
"method": "ApierV1.SetTPAccountActions",
"params": [
{
"Account": "1005",
"AccountActionsId": "AA_1005",
"ActionTimingsId": "AT_FS10",
"ActionTriggersId": "STANDARD_TRIGGERS",
"Direction": "*out",
"TPid": "CGR_API_TESTS",
"Tenant": "cgrates.org"
}
]
}
**Reply**:
Data:
::
string
Possible answers:
``OK`` - Success.
*JSON sample*:
::
{
"error": null,
"id": 48,
"result": "OK"
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``DUPLICATE`` - The specified combination of TPid/AccountActionsId already present in StorDb.
ApierV1.GetTPAccountActions
+++++++++++++++++++++++++
Queries specific AccountActions profile on tariff plan.
**Request**:
Data:
::
type AttrGetTPAccountActions struct {
TPid string // Tariff plan id
AccountActionsId string // AccountActions id
}
Mandatory parameters: ``[]string{"TPid", "AccountActionsId"}``
*JSON sample*:
::
{
"id": 49,
"method": "ApierV1.GetTPAccountActions",
"params": [
{
"AccountActionsId": "AA_1005",
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
type ApiTPAccountActions struct {
TPid string // Tariff plan id
AccountActionsId string // AccountActions id
Tenant string // Tenant's Id
Account string // Account name
Direction string // Traffic direction
ActionTimingsId string // Id of ActionTimings profile to use
ActionTriggersId string // Id of ActionTriggers profile to use
}
*JSON sample*:
::
{
"error": null,
"id": 49,
"result": {
"Account": "1005",
"AccountActionsId": "AA_1005",
"ActionTimingsId": "AT_FS10",
"ActionTriggersId": "STANDARD_TRIGGERS",
"Direction": "*out",
"TPid": "CGR_API_TESTS",
"Tenant": "cgrates.org"
}
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - Requested AccountActions profile not found.
ApierV1.GetTPAccountActionIds
+++++++++++++++++++++++++++
Queries AccountActions identities on specific tariff plan.
**Request**:
Data:
::
type AttrGetTPAccountActionIds struct {
TPid string // Tariff plan id
}
Mandatory parameters: ``[]string{"TPid"}``
*JSON sample*:
::
{
"id": 50,
"method": "ApierV1.GetTPAccountActionIds",
"params": [
{
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
[]string
*JSON sample*:
::
{
"error": null,
"id": 50,
"result": [
"AA_1005"
]
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - There are no AccountAction profiles defined on the selected TPid.

View File

@@ -1,232 +0,0 @@
ApierV1.SetTPActions
++++++++++++++++++
Creates a new Actions profile within a tariff plan.
**Request**:
Data:
::
type TPActions struct {
TPid string // Tariff plan id
ActionsId string // Actions id
Actions []Action // Set of actions this Actions profile will perform
}
type Action struct {
Identifier string // Identifier mapped in the code
BalanceType string // Type of balance the action will operate on
Direction string // Balance direction
Units float64 // Number of units to add/deduct
ExpiryTime string // Time when the units will expire
DestinationId string // Destination profile id
RatingSubject string // Reference a rate subject defined in RatingProfiles
BalanceWeight float64 // Balance weight
ExtraParameters string
Weight float64 // Action's weight
}
Mandatory parameters: ``[]string{"TPid", "ActionsId", "Actions", "Identifier", "Weight"}``
*JSON sample*:
::
{
"id": 39,
"method": "ApierV1.SetTPActions",
"params": [
{
"Actions": [
{
"BalanceType": "*monetary",
"BalanceWeight": 0,
"DestinationId": "*any",
"Direction": "*out",
"ExpiryTime": "0",
"Identifier": "*topup_reset",
"RatingSubject": "",
"Units": 10,
"Weight": 10
}
],
"ActionsId": "TOPUP_10",
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
string
Possible answers:
``OK`` - Success.
*JSON sample*:
::
{
"error": null,
"id": 39,
"result": "OK"
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``DUPLICATE`` - The specified combination of TPid/ActionsId already present in StorDb.
ApierV1.GetTPActions
++++++++++++++++++
Queries specific Actions profile on tariff plan.
**Request**:
Data:
::
type AttrGetTPActions struct {
TPid string // Tariff plan id
ActionsId string // Actions id
}
Mandatory parameters: ``[]string{"TPid", "ActionsId"}``
*JSON sample*:
::
{
"id": 40,
"method": "ApierV1.GetTPActions",
"params": [
{
"ActionsId": "TOPUP_10",
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
type TPActions struct {
TPid string // Tariff plan id
ActionsId string // Actions id
Actions []Action // Set of actions this Actions profile will perform
}
type Action struct {
Identifier string // Identifier mapped in the code
BalanceType string // Type of balance the action will operate on
Direction string // Balance direction
Units float64 // Number of units to add/deduct
ExpiryTime string // Time when the units will expire
DestinationId string // Destination profile id
RatingSubject string // Reference a rate subject defined in RatingProfiles
BalanceWeight float64 // Balance weight
ExtraParameters string
Weight float64 // Action's weight
}
*JSON sample*:
::
{
"error": null,
"id": 40,
"result": {
"Actions": [
{
"BalanceType": "*monetary",
"BalanceWeight": 0,
"DestinationId": "*any",
"Direction": "*out",
"ExpiryTime": "0",
"ExtraParameters": "",
"Identifier": "*topup_reset",
"RatingSubject": "",
"Units": 10,
"Weight": 10
}
],
"ActionsId": "TOPUP_10",
"TPid": "CGR_API_TESTS"
}
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - Requested Actions profile not found.
ApierV1.GetTPActionIds
++++++++++++++++++++
Queries Actions identities on specific tariff plan.
**Request**:
Data:
::
type AttrGetTPActionIds struct {
TPid string // Tariff plan id
}
Mandatory parameters: ``[]string{"TPid"}``
*JSON sample*:
::
{
"id": 41,
"method": "ApierV1.GetTPActionIds",
"params": [
{
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
[]string
*JSON sample*:
::
{
"error": null,
"id": 41,
"result": [
"TOPUP_10"
]
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - There are no Actions profiles defined on the selected TPid.

View File

@@ -1,204 +0,0 @@
ApierV1.SetTPActionTimings
++++++++++++++++++++++++
Creates a new ActionTimings profile within a tariff plan.
**Request**:
Data:
::
type ApiTPActionTimings struct {
TPid string // Tariff plan id
ActionTimingsId string // ActionTimings id
ActionTimings []ApiActionTiming // Set of ActionTiming bindings this profile will group
}
type ApiActionTiming struct {
ActionsId string // Actions id
TimingId string // Timing profile id
Weight float64 // Binding's weight
}
Mandatory parameters: ``[]string{"TPid", "ActionTimingsId", "ActionTimings", "ActionsId", "TimingId", "Weight"}``
*JSON sample*:
::
{
"id": 42,
"method": "ApierV1.SetTPActionTimings",
"params": [
{
"ActionTimings": [
{
"ActionsId": "TOPUP_10",
"TimingId": "ASAP",
"Weight": 10
}
],
"ActionTimingsId": "AT_FS10",
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
string
Possible answers:
``OK`` - Success.
*JSON sample*:
::
{
"error": null,
"id": 42,
"result": "OK"
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``DUPLICATE`` - The specified combination of TPid/ActionTimingsId already present in StorDb.
ApierV1.GetTPActionTimings
++++++++++++++++++++++++++
Queries specific ActionTimings profile on tariff plan.
**Request**:
Data:
::
type AttrGetTPActionTimings struct {
TPid string // Tariff plan id
ActionTimingsId string // ActionTimings id
}
Mandatory parameters: ``[]string{"TPid", "ActionTimingsId"}``
*JSON sample*:
::
{
"id": 43,
"method": "ApierV1.GetTPActionTimings",
"params": [
{
"ActionTimingsId": "AT_FS10",
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
type ApiTPActionTimings struct {
TPid string // Tariff plan id
ActionTimingsId string // ActionTimings id
ActionTimings []ApiActionTiming // Set of ActionTiming bindings this profile will group
}
type ApiActionTiming struct {
ActionsId string // Actions id
TimingId string // Timing profile id
Weight float64 // Binding's weight
}
*JSON sample*:
::
{
"error": null,
"id": 43,
"result": {
"ActionTimings": [
{
"ActionsId": "TOPUP_10",
"TimingId": "ASAP",
"Weight": 10
}
],
"ActionTimingsId": "AT_FS10",
"TPid": "CGR_API_TESTS"
}
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - Requested ActionTimings profile not found.
ApierV1.GetTPActionTimingIds
++++++++++++++++++++++++++
Queries ActionTimings identities on specific tariff plan.
**Request**:
Data:
::
type AttrGetTPActionTimingIds struct {
TPid string // Tariff plan id
}
Mandatory parameters: ``[]string{"TPid"}``
*JSON sample*:
::
{
"id": 44,
"method": "ApierV1.GetTPActionTimingIds",
"params": [
{
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
[]string
*JSON sample*:
::
{
"error": null,
"id": 44,
"result": [
"AT_FS10"
]
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - There are no ActionTimings profiles defined on the selected TPid.

View File

@@ -1,257 +0,0 @@
ApierV1.SetTPActionTriggers
+++++++++++++++++++++++++++
Creates a new ActionTriggers profile within a tariff plan.
**Request**:
Data:
::
type ApiTPActionTriggers struct {
TPid string // Tariff plan id
ActionTriggersId string // Profile id
ActionTriggers []ApiActionTrigger // Set of triggers grouped in this profile
}
type ApiActionTrigger struct {
BalanceType string // Id of the balance this trigger monitors
Direction string // Traffic direction
ThresholdType string // This threshold type
ThresholdValue float64 // Threshold
DestinationId string // Id of the destination profile
ActionsId string // Actions which will execute on threshold reached
Weight float64 // weight
}
Mandatory parameters: ``[]string{"TPid", "ActionTriggersId","BalanceType", "Direction", "ThresholdType", "ThresholdValue", "ActionsId", "Weight"}``
*JSON sample*:
::
{
"id": 45,
"method": "ApierV1.SetTPActionTriggers",
"params": [
{
"ActionTriggers": [
{
"ActionsId": "LOG_BALANCE",
"BalanceType": "*monetary",
"DestinationId": "",
"Direction": "*out",
"ThresholdType": "*min_balance",
"ThresholdValue": 2,
"Weight": 10
},
{
"ActionsId": "LOG_BALANCE",
"BalanceType": "*monetary",
"DestinationId": "",
"Direction": "*out",
"ThresholdType": "*max_balance",
"ThresholdValue": 20,
"Weight": 10
},
{
"ActionsId": "LOG_BALANCE",
"BalanceType": "*monetary",
"DestinationId": "FS_USERS",
"Direction": "*out",
"ThresholdType": "*max_counter",
"ThresholdValue": 15,
"Weight": 10
}
],
"ActionTriggersId": "STANDARD_TRIGGERS",
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
string
Possible answers:
``OK`` - Success.
*JSON sample*:
::
{
"error": null,
"id": 45,
"result": "OK"
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``DUPLICATE`` - The specified combination of TPid/ActionTriggersId already present in StorDb.
ApierV1.GetTPActionTriggers
+++++++++++++++++++++++++++
Queries specific ActionTriggers profile on tariff plan.
**Request**:
Data:
::
type AttrGetTPActionTriggers struct {
TPid string // Tariff plan id
ActionTriggersId string // ActionTrigger id
}
Mandatory parameters: ``[]string{"TPid", "ActionTriggersId"}``
*JSON sample*:
::
{
"id": 46,
"method": "ApierV1.GetTPActionTriggers",
"params": [
{
"ActionTriggersId": "STANDARD_TRIGGERS",
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
type ApiTPActionTriggers struct {
TPid string // Tariff plan id
ActionTriggersId string // Profile id
ActionTriggers []ApiActionTrigger // Set of triggers grouped in this profile
}
type ApiActionTrigger struct {
BalanceType string // Id of the balance this trigger monitors
Direction string // Traffic direction
ThresholdType string // This threshold type
ThresholdValue float64 // Threshold
DestinationId string // Id of the destination profile
ActionsId string // Actions which will execute on threshold reached
Weight float64 // weight
}
*JSON sample*:
::
{
"error": null,
"id": 46,
"result": {
"ActionTriggers": [
{
"ActionsId": "LOG_BALANCE",
"BalanceType": "*monetary",
"DestinationId": "",
"Direction": "*out",
"ThresholdType": "*min_balance",
"ThresholdValue": 2,
"Weight": 10
},
{
"ActionsId": "LOG_BALANCE",
"BalanceType": "*monetary",
"DestinationId": "",
"Direction": "*out",
"ThresholdType": "*max_balance",
"ThresholdValue": 20,
"Weight": 10
},
{
"ActionsId": "LOG_BALANCE",
"BalanceType": "*monetary",
"DestinationId": "FS_USERS",
"Direction": "*out",
"ThresholdType": "*max_counter",
"ThresholdValue": 15,
"Weight": 10
}
],
"ActionTriggersId": "STANDARD_TRIGGERS",
"TPid": "CGR_API_TESTS"
}
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - Requested ActionTriggersId profile not found.
ApierV1.GetTPActionTriggerIds
+++++++++++++++++++++++++++++
Queries ActionTriggers identities on specific tariff plan.
**Request**:
Data:
::
type AttrGetTPActionTriggerIds struct {
TPid string // Tariff plan id
}
Mandatory parameters: ``[]string{"TPid"}``
*JSON sample*:
::
{
"id": 47,
"method": "ApierV1.GetTPActionTriggerIds",
"params": [
{
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
[]string
*JSON sample*:
::
{
"error": null,
"id": 47,
"result": [
"STANDARD_TRIGGERS"
]
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - There are no ActionTriggers profiles defined on the selected TPid.

View File

@@ -1,202 +0,0 @@
ApierV1.SetTPDestinationRate
++++++++++++++++++++++++++
Creates a new DestinationRate profile within a tariff plan.
**Request**:
Data:
::
type TPDestinationRate struct {
TPid string // Tariff plan id
DestinationRateId string // DestinationRate profile id
DestinationRates []DestinationRate // Set of destinationid-rateid bindings
}
type DestinationRate struct {
DestinationId string // The destination identity
RateId string // The rate identity
}
Mandatory parameters: ``[]string{"TPid", "DestinationRateId", "DestinationRates"}``
*JSON sample*:
::
{
"id": 7,
"method": "ApierV1.SetTPDestinationRate",
"params": [
{
"DestinationRateId": "DR_1CENTPERSEC",
"DestinationRates": [
{
"DestinationId": "FS_USERS",
"RateId": "1CENTPERSEC"
}
],
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
string
Possible answers:
``OK`` - Success.
*JSON sample*:
::
{
"error": null,
"id": 7,
"result": "OK"
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``DUPLICATE`` - The specified combination of TPid/DestinationRateId already exists in StorDb.
ApierV1.GetTPDestinationRate
+++++++++++++++
Queries specific DestinationRate profile on tariff plan.
**Request**:
Data:
::
type AttrGetTPDestinationRate struct {
TPid string // Tariff plan id
DestinationRateId string // Rate id
}
Mandatory parameters: ``[]string{"TPid", "DestinationRateId"}``
*JSON sample*:
::
{
"id": 8,
"method": "ApierV1.GetTPDestinationRate",
"params": [
{
"DestinationRateId": "DR_1CENTPERSEC",
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
type TPDestinationRate struct {
TPid string // Tariff plan id
DestinationRateId string // DestinationRate profile id
DestinationRates []DestinationRate // Set of destinationid-rateid bindings
}
type DestinationRate struct {
DestinationId string // The destination identity
RateId string // The rate identity
}
*JSON sample*:
::
{
"error": null,
"id": 8,
"result": {
"DestinationRateId": "DR_1CENTPERSEC",
"DestinationRates": [
{
"DestinationId": "FS_USERS",
"RateId": "1CENTPERSEC"
}
],
"TPid": "CGR_API_TESTS"
}
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - Requested DestinationRate id not found.
ApierV1.GetTPDestinationRateIds
+++++++++++++++++++++++++++++
Queries DestinationRate identities on specific tariff plan.
**Request**:
Data:
::
type AttrTPDestinationRateIds struct {
TPid string // Tariff plan id
}
Mandatory parameters: ``[]string{"TPid"}``
*JSON sample*:
::
{
"id": 9,
"method": "ApierV1.GetTPDestinationRateIds",
"params": [
{
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
[]string
*JSON sample*:
::
{
"error": null,
"id": 9,
"result": [
"DR_1CENTPERSEC"
]
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - Requested tariff plan not found.

View File

@@ -1,187 +0,0 @@
ApierV1.SetTPDestination
++++++++++++++++++++++
Creates a new destination within a tariff plan id.
**Request**:
Data:
::
type ApierTPDestination struct {
TPid string // Tariff plan id
DestinationId string // Destination id
Prefixes []string // Prefixes attached to this destination
}
Required parameters: ``[]string{"TPid", "DestinationId", "Prefixes"}``
*JSON sample*:
::
{
"id": 6,
"method": "ApierV1.SetTPDestination",
"params": [
{
"DestinationId": "FS_USERS",
"Prefixes": [
"10"
],
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
string
Possible answers:
``OK`` - Success.
*JSON sample*:
::
{
"error": null,
"id": 6,
"result": "OK"
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``DUPLICATE`` - The specified combination of TPid/DestinationId already exists in StorDb.
ApierV1.GetTPDestination
++++++++++++++++++++++
Queries a specific destination.
**Request**:
Data:
::
type AttrGetTPDestination struct {
TPid string // Tariff plan id
DestinationId string // Destination id
}
Required parameters: ``[]string{"TPid", "DestinationId"}``
*JSON sample*:
::
{
"id": 7,
"method": "ApierV1.GetTPDestination",
"params": [
{
"DestinationId": "FS_USERS",
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
type ApierTPDestination struct {
TPid string // Tariff plan id
DestinationId string // Destination id
Prefixes []string // Prefixes attached to this destination
}
*JSON sample*:
::
{
"error": null,
"id": 7,
"result": {
"DestinationId": "FS_USERS",
"Prefixes": [
"10"
],
"TPid": "CGR_API_TESTS"
}
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - Requested destination id not found.
ApierV1.GetTPDestinationIds
+++++++++++++++++++++++++
Queries destination identities on specific tariff plan.
**Request**:
Data:
::
type AttrGetTPDestinationIds struct {
TPid string // Tariff plan id
}
Required parameters: ``[]string{"TPid"}``
*JSON sample*:
::
{
"id": 8,
"method": "ApierV1.GetTPDestinationIds",
"params": [
{
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
[]string
*JSON sample*:
::
{
"error": null,
"id": 8,
"result": [
"FS_USERS"
]
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - Requested tariff plan not found.

View File

@@ -1,203 +0,0 @@
ApierV1.SetTPDestRateTiming
+++++++++++++++++++++++++
Creates a new DestinationRateTiming profile within a tariff plan.
**Request**:
Data:
::
type TPDestRateTiming struct {
TPid string // Tariff plan id
DestRateTimingId string // DestinationRate profile id
DestRateTimings []DestRateTiming // Set of destinationid-rateid bindings
}
type DestRateTiming struct {
DestRatesId string // The DestinationRate identity
TimingId string // The timing identity
Weight float64 // Binding priority taken into consideration when more DestinationRates are active on a time slot
}
Mandatory parameters: ``[]string{"TPid", "DestRateTimingId", "DestRateTimings"}``
*JSON sample*:
::
{
"id": 10,
"method": "ApierV1.SetTPDestRateTiming",
"params": [
{
"DestRateTimingId": "DRT_1CENTPERSEC",
"DestRateTimings": [
{
"DestRatesId": "DR_1CENTPERSEC",
"TimingId": "ALWAYS",
"Weight": 10
}
],
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
string
Possible answers:
``OK`` - Success.
*JSON sample*:
::
{
"error": null,
"id": 10,
"result": "OK"
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``DUPLICATE`` - The specified combination of TPid/DestRateTimingId already exists in StorDb.
ApierV1.GetTPDestRateTiming
+++++++++++++++++++++++++
Queries specific DestRateTiming profile on tariff plan.
**Request**:
Data:
::
type AttrGetTPDestRateTiming struct {
TPid string // Tariff plan id
DestRateTimingId string // Rate id
}
Mandatory parameters: ``[]string{"TPid", "DestRateTimingId"}``
*JSON sample*:
::
{
"id": 11,
"method": "ApierV1.GetTPDestRateTiming",
"params": [
{
"DestRateTimingId": "DRT_1CENTPERSEC",
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
type TPDestRateTiming struct {
TPid string // Tariff plan id
DestRateTimingId string // DestinationRate profile id
DestRateTimings []DestRateTiming // Set of destinationid-rateid bindings
}
type DestRateTiming struct {
DestRatesId string // The DestinationRate identity
TimingId string // The timing identity
Weight float64 // Binding priority taken into consideration when more DestinationRates are active on a time slot
}
*JSON sample*:
::
{
"error": null,
"id": 11,
"result": {
"DestRateTimingId": "DRT_1CENTPERSEC",
"DestRateTimings": [
{
"DestRatesId": "DR_1CENTPERSEC",
"TimingId": "ALWAYS",
"Weight": 10
}
],
"TPid": "CGR_API_TESTS"
}
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - Requested DestRateTiming profile not found.
ApierV1.GetTPDestRateTimingIds
++++++++++++++++++++++++++++
Queries DestRateTiming identities on specific tariff plan.
**Request**:
Data:
::
type AttrTPDestRateTimingIds struct {
TPid string // Tariff plan id
}
Mandatory parameters: ``[]string{"TPid"}``
*JSON sample*:
::
{
"id": 12,
"method": "ApierV1.GetTPDestRateTimingIds",
"params": [
{
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
[]string
*JSON sample*:
::
{
"error": null,
"id": 12,
"result": [
"DRT_1CENTPERSEC"
]
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - Requested tariff plan not found.

View File

@@ -1,222 +0,0 @@
ApierV1.SetTPRate
+++++++++++++++
Creates a new rate within a tariff plan.
**Request**:
Data:
::
type TPRate struct {
TPid string // Tariff plan id
RateId string // Rate id
RateSlots []RateSlot // One or more RateSlots
}
type RateSlot struct {
ConnectFee float64 // ConnectFee applied once the call is answered
Rate float64 // Rate applied
RateUnit string // Number of billing units this rate applies to
RateIncrement string // This rate will apply in increments of duration
GroupIntervalStart string // Group position
RoundingMethod string // Use this method to round the cost
RoundingDecimals int // Round the cost number of decimals
}
Mandatory parameters: ``[]string{"TPid", "RateId", "ConnectFee", "RateSlots"}``
*JSON sample*:
::
{
"id": 2,
"method": "ApierV1.SetTPRate",
"params": [
{
"RateId": "1CENTPERSEC",
"RateSlots": [
{
"ConnectFee": 0,
"GroupIntervalStart": "0",
"Rate": 0.01,
"RateIncrement": "1s",
"RateUnit": "1s",
"RoundingDecimals": 4,
"RoundingMethod": "*middle",
"Weight": 10
}
],
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
string
Possible answers:
``OK`` - Success.
*JSON sample*:
::
{
"error": null,
"id": 0,
"result": "OK"
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``DUPLICATE`` - The specified combination of TPid/RateId already exists in StorDb.
ApierV1.GetTPRate
+++++++++++++++
Queries specific rate on tariff plan.
**Request**:
Data:
::
type AttrGetTPRate struct {
TPid string // Tariff plan id
RateId string // Rate id
}
Mandatory parameters: ``[]string{"TPid", "RateId"}``
*JSON sample*:
::
{
"id": 3,
"method": "ApierV1.GetTPRate",
"params": [
{
"RateId": "1CENTPERSEC",
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
type TPRate struct {
TPid string // Tariff plan id
RateId string // Rate id
RateSlots []RateSlot // One or more RateSlots
}
type RateSlot struct {
ConnectFee float64 // ConnectFee applied once the call is answered
Rate float64 // Rate applied
RateUnit string // Number of billing units this rate applies to
RateIncrement string // This rate will apply in increments of duration
GroupIntervalStart string // Group position
RoundingMethod string // Use this method to round the cost
RoundingDecimals int // Round the cost number of decimals
}
*JSON sample*:
::
{
"error": null,
"id": 3,
"result": {
"RateId": "1CENTPERSEC",
"RateSlots": [
{
"ConnectFee": 0,
"GroupIntervalStart": "0",
"Rate": 0.01,
"RateIncrement": "1s",
"RateUnit": "1s",
"RoundingDecimals": 4,
"RoundingMethod": "*middle"
}
],
"TPid": "CGR_API_TESTS"
}
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - Requested rate id not found.
ApierV1.GetTPRateIds
++++++++++++++++++
Queries rate identities on tariff plan.
**Request**:
Data:
::
type AttrGetTPRateIds struct {
TPid string // Tariff plan id
}
Mandatory parameters: ``[]string{"TPid"}``
*JSON sample*:
::
{
"id": 4,
"method": "ApierV1.GetTPRateIds",
"params": [
{
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
[]string
*JSON sample*:
::
{
"error": null,
"id": 4,
"result": [
"1CENTPERSEC"
]
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - Requested tariff plan not found.

View File

@@ -1,225 +0,0 @@
ApierV1.SetTPRatingProfile
++++++++++++++++++++++++
Creates a new RatingProfile within a tariff plan.
**Request**:
Data:
::
type TPRatingProfile struct {
TPid string // Tariff plan id
RatingProfileId string // RatingProfile id
Tenant string // Tenant's Id
TOR string // TypeOfRecord
Direction string // Traffic direction, *out is the only one supported for now
Subject string // Rating subject, usually the same as account
RatesFallbackSubject string // Fallback on this subject if rates not found for destination
RatingActivations []RatingActivation // Activate rate profiles at specific time
}
type RatingActivation struct {
ActivationTime int64 // Time when this profile will become active, defined as unix epoch time
DestRateTimingId string // Id of DestRateTiming profile
}
Mandatory parameters: ``[]string{"TPid", "RatingProfileId", "Tenant", "TOR", "Direction", "Subject", "RatingActivations"}``
*JSON sample*:
::
{
"id": 14,
"method": "ApierV1.SetTPRatingProfile",
"params": [
{
"Direction": "*out",
"RatesFallbackSubject": "",
"RatingActivations": [
{
"ActivationTime": "2012-01-01T00:00:00Z",
"DestRateTimingId": "DRT_1CENTPERSEC"
}
],
"RatingProfileId": "RP_ANY",
"Subject": "*any",
"TOR": "call",
"TPid": "CGR_API_TESTS",
"Tenant": "cgrates.org"
}
]
}
**Reply**:
Data:
::
string
Possible answers:
``OK`` - Success.
*JSON sample*:
::
{
"error": null,
"id": 14,
"result": "OK"
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``DUPLICATE`` - The specified combination of TPid/RatingProfileId already exists in StorDb.
ApierV1.GetTPRatingProfile
++++++++++++++++++++++++
Queries specific RatingProfile on tariff plan.
**Request**:
Data:
::
type AttrGetTPRatingProfile struct {
TPid string // Tariff plan id
RatingProfileId string // RatingProfile id
}
Mandatory parameters: ``[]string{"TPid", "RatingProfileId"}``
*JSON sample*:
::
{
"id": 15,
"method": "ApierV1.GetTPRatingProfile",
"params": [
{
"RatingProfileId": "RP_ANY",
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
type TPRatingProfile struct {
TPid string // Tariff plan id
RatingProfileId string // RatingProfile id
Tenant string // Tenant's Id
TOR string // TypeOfRecord
Direction string // Traffic direction, *out is the only one supported for now
Subject string // Rating subject, usually the same as account
RatesFallbackSubject string // Fallback on this subject if rates not found for destination
RatingActivations []RatingActivation // Activate rate profiles at specific time
}
type RatingActivation struct {
ActivationTime int64 // Time when this profile will become active, defined as unix epoch time
DestRateTimingId string // Id of DestRateTiming profile
}
*JSON sample*:
::
{
"error": null,
"id": 15,
"result": {
"Direction": "*out",
"RatesFallbackSubject": "",
"RatingActivations": [
{
"ActivationTime": "2012-01-01T00:00:00Z",
"DestRateTimingId": "DRT_1CENTPERSEC"
}
],
"RatingProfileId": "RP_ANY",
"Subject": "*any",
"TOR": "call",
"TPid": "CGR_API_TESTS",
"Tenant": "cgrates.org"
}
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - Requested RatingProfile profile not found.
ApierV1.GetTPRatingProfileIds
+++++++++++++++++++++++++++
Queries specific RatingProfile on tariff plan. Attribute parameters used as extra filters.
**Request**:
Data:
::
type AttrTPRatingProfileIds struct {
TPid string // Tariff plan id
Tenant string // Tenant's Id
TOR string // TypeOfRecord
Direction string // Traffic direction
Subject string // Rating subject, usually the same as account
}
Mandatory parameters: ``[]string{"TPid"}``
*JSON sample*:
::
{
"id": 16,
"method": "ApierV1.GetTPRatingProfileIds",
"params": [
{
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
[]string
*JSON sample*:
::
{
"error": null,
"id": 16,
"result": [
"RP_ANY"
]
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - There is no data to be returned based on filters set.

View File

@@ -1,197 +0,0 @@
ApierV1.SetTPTiming
===================
Creates a new timing within a tariff plan.
**Request**:
Data:
::
type ApierTPTiming struct {
TPid string // Tariff plan id
ID string // Timing id
Years string // semicolon separated list of years this timing is valid on, \*any supported
Months string // semicolon separated list of months this timing is valid on, \*any supported
MonthDays string // semicolon separated list of month's days this timing is valid on, \*any supported
WeekDays string // semicolon separated list of week day names this timing is valid on \*any supported
Time string // String representing the time this timing starts on
}
Mandatory parameters: ``[]string{"TPid", "ID", "Years", "Months", "MonthDays", "WeekDays", "Time"}``
*JSON sample*:
::
{
"id": 3,
"method": "ApierV1.SetTPTiming",
"params": [
{
"MonthDays": "*any",
"Months": "*any",
"TPid": "TEST_SQL",
"Time": "00:00:00",
"ID": "ALWAYS",
"WeekDays": "*any",
"Years": "*any"
}
]
}
**Reply**:
Data:
::
string
Possible answers:
``OK`` - Success.
*JSON sample*:
::
{
"error": null,
"id": 3,
"result": "OK"
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
ApierV1.GetTPTiming
===================
Queries specific Timing on tariff plan.
**Request**:
Data:
::
type AttrGetTPTiming struct {
TPid string // Tariff plan id
TimingId string // Timing id
}
Mandatory parameters: ``[]string{"TPid", "TimingId"}``
*JSON sample*:
::
{
"id": 5,
"method": "ApierV1.GetTPTiming",
"params": [
{
"TPid": "TEST_SQL",
"ID": "ALWAYS"
}
]
}
**Reply**:
Data:
::
type ApierTPTiming struct {
TPid string // Tariff plan id
ID string // Timing id
Years string // semicolon separated list of years this timing is valid on, \*any supported
Months string // semicolon separated list of months this timing is valid on, \*any supported
MonthDays string // semicolon separated list of month's days this timing is valid on, \*any supported
WeekDays string // semicolon separated list of week day names this timing is valid on \*any supported
Time string // String representing the time this timing starts on
}
*JSON sample*:
::
{
"error": null,
"id": 5,
"result": {
"MonthDays": "*any",
"Months": "*any",
"TPid": "TEST_SQL",
"Time": "00:00:00",
"TimingId": "ALWAYS2",
"WeekDays": "*any",
"Years": "*any"
}
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - Requested timing id not found.
ApierV1.GetTPTimingIds
======================
Queries timing identities on tariff plan.
**Request**:
Data:
::
type AttrGetTPTimingIds struct {
TPid string // Tariff plan id
}
Mandatory parameters: ``[]string{"TPid"}``
*JSON sample*:
::
{
"id": 4,
"method": "ApierV1.GetTPTimingIds",
"params": [
{
"TPid": "CGR_API_TESTS"
}
]
}
**Reply**:
Data:
::
[]string
*JSON sample*:
::
{
"error": null,
"id": 4,
"result": [
"ASAP"
]
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - Requested tariff plan not found.

View File

@@ -1,374 +1,8 @@
API Calls
=========
The general API usage of the CGRateS involves creating a CallDescriptor structure sending it to the rater via JSON/GOB RPC and getting a response from the rater in form of a CallCost structure or a numeric value for requested information.
CallDescriptor structure
------------------------
- Direction, TOR, Tenant, Subject, Account, DestinationPrefix string
- TimeStart, TimeEnd Time
- Amount float64
Direction
The direction of the call (inbound or outbound)
TOR
Type Of Record, used to differentiate between various type of records
Tenant
Customer Identification used for multi tenant databases
Subject
Subject for this query
Account
Used when different from subject
Destination
Destination call id to be matched
TimeStart, TimeEnd
The start and end of the call in question
Amount
The amount requested in various API calls (e.g. DebitSMS amount)
The **Subject** field is used usually used to identify both the client in the detailed cost list and the user in the balances database. When there is some additional info added to the subject for the call price list then the **Account** attribute is used to specify the balance for the client. For example: the subject can be rif:from:ha or rif:form:mu and for both we would use the rif account.
CallCost structure
------------------
- TOR int
- CstmId, Subject, DestinationPrefix string
- Cost, ConnectFee float64
- Timespans []*TimeSpan
TOR
Type Of Record, used to differentiate between various type of records (for query identification and confirmation)
CstmId
Customer Identification used for multi tenant databases (for query identification and confirmation)
Subject
Subject for this query (for query identification and confirmation)
DestinationPrefix
Destination prefix to be matched (for query identification and confirmation)
Cost
The requested cost
ConnectFee
The requested connection cost
Timespans
The timespans in witch the initial TimeStart-TimeEnd was split in for cost determination with all pricing and cost information attached.
As stated before the rater can be accesed via json rpc.
The smallest python snippet to access the CGRateS rater is this:
::
cd = {"Tor":0,
"CstmId": "vdf",
"Subject": "rif",
"DestinationPrefix": "0256",
"TimeStart": "2012-02-02T17:30:00Z",
"TimeEnd": "2012-02-02T18:30:00Z"}
s = socket.create_connection(("127.0.0.1", 2001))
s.sendall(json.dumps(({"id": 1, "method": "Responder.Get", "params": [cd]})))
print s.recv(4096)
This also gives you a pretty good idea of how JSON-RPC works. You can find details in the specification_. A call to a JSON-RPC server simply sends a block of data through a socket. The data is formatted as a JSON structure, and a call consists of an id (so you can sort out the results when they come back), the name of the method to execute on the server, and params, an array of parameters which can itself consist of complex JSON objects. The dumps() call converts the Python structure into JSON.
.. _specification: http://json-rpc.org/wiki/specification
In the stress folder you can find a better example of python client using a class that reduces the actual call code to::
rpc =JSONClient(("127.0.0.1", 2001))
result = rpc.call("Responder.Get", cd)
print result
Call API
--------
GetCost
Creates a CallCost structure with the cost information calculated for the received CallDescriptor.
Debit
Interface method used to add/substract an amount of cents or bonus seconds (as returned by GetCost method) from user's money balance.
MaxDebit
Interface method used to add/subtract an amount of cents or bonus seconds (as returned by GetCost method) from user's money balance.
This methods combines the Debit and GetMaxSessionTime and will debit the max available time as returned by the GetMaxSessionTime method. The amount filed has to be filled in call descriptor.
DebitBalance
Interface method used to add/subtract an amount of cents from user's money budget.
The amount filed has to be filled in call descriptor.
DebitSMS
Interface method used to add/subtract an amount of units from user's SMS budget.
The amount filed has to be filled in call descriptor.
DebitSeconds
Interface method used to add/subtract an amount of seconds from user's minutes budget.
The amount filed has to be filled in call descriptor.
GetMaxSessionTime
Returns the approximate max allowed session for user budget. It will try the max amount received in the call descriptor
and will decrease it by 10% for nine times. So if the user has little credit it will still allow 10% of the initial amount.
If the user has no credit then it will return 0.
AddRecievedCallSeconds
Adds the specified amount of seconds to the received call seconds. When the threshold specified in the user's tariff plan is reached then the received call budget is reseted and the bonus specified in the tariff plan is applied.
The amount filed has to be filled in call descriptor.
FlushCache
Cleans all internal cached (Destinations, RatingProfiles)
Tariff plan importer APIs
-------------------------
These operate on a tpid and are used to import the tariff plan content into storDb.
TariffPlan
~~~~~~~~~~
.. toctree::
:maxdepth: 2
api_tp
Timings
~~~~~~~
.. toctree::
:maxdepth: 2
api_tptimings
Destinations
~~~~~~~~~~~~
.. toctree::
:maxdepth: 2
api_tpdestinations
Rates
~~~~~
.. toctree::
:maxdepth: 2
api_tprates
DestinationRates
~~~~~~~~~~~~~~~~
.. toctree::
:maxdepth: 2
api_tpdestinationrates
DestinationRateTimings
~~~~~~~~~~~~~~~~~~~~~~
.. toctree::
:maxdepth: 2
api_tpdestratetimings
RatingProfiles
~~~~~~~~~~~~~~
.. toctree::
:maxdepth: 2
api_tpratingprofiles
Actions
~~~~~~~
.. toctree::
:maxdepth: 2
api_tpactions
ActionTimings
~~~~~~~~~~~~~
.. toctree::
:maxdepth: 2
api_tpactiontimings
ActionTriggers
~~~~~~~~~~~~~~
.. toctree::
:maxdepth: 2
api_tpactiontriggers
AccountActions
~~~~~~~~~~~~~~
.. toctree::
:maxdepth: 2
api_tpaccountactions
Management API
--------------
These operate on live data.
GetDestination
++++++++++++++
Gets the destinations for the specified tag.
::
type AttrDestination struct {
Id string
Prefixes []string
}
Only the Id field must be set for get operation.
Example
GetDestination(attr \*AttrDestination, reply \*AttrDestination)
GetBalance
++++++++++
Gets a specific balance of a user acoount.
::
type AttrGetBalance struct {
Tenant string
Account string
BalanceId string
Direction string
}
The Tenant is the network tenant of the account.
The Account is the id of the account for which the balance is desired.
The BalanceId can have one of the following string values: MONETARY, SMS, INTERNET, INTERNET_TIME, MINUTES.
Direction can be the strings IN or OUT (default OUT).
Return value is the balance value as float64.
Example
GetBalance(attr \*AttrGetBalance, reply \*float64)
AddBalance
++++++++++
Adds an amount to a specific balance of a user account.
::
type AttrAddBalance struct {
Tenant string
Account string
BalanceId string
Direction string
Value float64
}
The Tenant is the network tenant of the account.
The Account is the id of the account for which the balance is set.
The BalanceId can have one of the following string values: MONETARY, SMS, INTERNET, INTERNET_TIME, MINUTES.
Direction can be the strings IN or OUT (default OUT).
Value is the amount to be added to the specified balance.
Example
AddBalance(attr \*AttrAddBalance, reply \*float64)
ExecuteAction
+++++++++++++
Executes specified action on a user account.
::
type AttrExecuteAction struct {
Direction string
Tenant string
Account string
ActionsId string
}
Example
ExecuteAction(attr \*AttrExecuteAction, reply \*float64)
AddTriggeredAction
++++++++++++++++++
::
type AttrAddActionTrigger struct {
Tenant string
Account string
Direction string
BalanceId string
ThresholdValue float64
DestinationId string
Weight float64
ActionsId string
}
Example
AddTriggeredAction(attr \*AttrAddActionTrigger, reply \*float64)
SetAcount
+++++++++
::
type AttrSetAccount struct {
Tenant string
Direction string
Account string
Type string // <*prepaid|*postpaid>
ActionTimingsId string
}
Example
AddAccount(attr \*AttrAddAccount, reply \*string)
RatingProfiles
~~~~~~~~~~~~~~
.. toctree::
:maxdepth: 2
api_ratingprofiles
Accounts
~~~~~~~~
.. toctree::
:maxdepth: 2
api_accounts
Administration APIs
-------------------
.. toctree::
:maxdepth: 2
api_cdrs
api_cache
api_scheduler
API calls are documented in the following GoDoc_
.. _GoDoc : http://www.asterisk.org/