Adding TPDestinationRates API documentation

This commit is contained in:
DanB
2013-07-10 17:31:44 +02:00
parent f3dbbf77fc
commit 89af3fa82e
3 changed files with 239 additions and 11 deletions

View File

@@ -59,7 +59,7 @@ CREATE TABLE `tp_destination_rates` (
`rates_tag` varchar(24) NOT NULL,
PRIMARY KEY (`id`),
KEY `tpid` (`tpid`),
UNIQUE KEY `tpid_tag_dst_rates` (`tpid`,`tag`,`destinations_tag`, `rates_tag`)
UNIQUE KEY `tpid_tag_dst_rates` (`tpid`,`tag`,`destinations_tag`)
);
--

View File

@@ -0,0 +1,220 @@
Apier.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": 2,
"method": "Apier.SetTPDestinationRate",
"params": [
{
"DestinationRateId": "DST_RATE_1",
"DestinationRates": [
{
"DestinationId": "FIST_DST2",
"RateId": "SAMPLE_RATE_4"
},
{
"DestinationId": "DST_2",
"RateId": "SAMPLE_RATE_4"
},
{
"DestinationId": "DST_3",
"RateId": "SAMPLE_RATE_5"
}
],
"TPid": "FIST_TP"
}
]
}
**Reply**:
Data:
::
string
Possible answers:
``OK`` - Success.
*JSON sample*:
::
{
"error": null,
"id": 2,
"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.
Apier.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": 2,
"method": "Apier.GetTPDestinationRate",
"params": [
{
"DestinationRateId": "DST_RATE_1",
"TPid": "FIST_TP"
}
]
}
**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": 2,
"result": {
"DestinationRateId": "DST_RATE_1",
"DestinationRates": [
{
"DestinationId": "DST_2",
"RateId": "SAMPLE_RATE_4"
},
{
"DestinationId": "DST_3",
"RateId": "SAMPLE_RATE_5"
},
{
"DestinationId": "FIST_DST2",
"RateId": "SAMPLE_RATE_4"
}
],
"TPid": "FIST_TP"
}
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - Requested DestinationRate id not found.
Apier.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": 3,
"method": "Apier.GetTPDestinationRateIds",
"params": [
{
"TPid": "FIST_TP"
}
]
}
**Reply**:
Data:
::
[]string
*JSON sample*:
::
{
"error": null,
"id": 3,
"result": [
"DST_RATE_1",
"DST_RATE_2",
"DST_RATE_3"
]
}
**Errors**:
``MANDATORY_IE_MISSING`` - Mandatory parameter missing from request.
``SERVER_ERROR`` - Server error occurred.
``NOT_FOUND`` - Requested tariff plan not found.

View File

@@ -130,16 +130,6 @@ TariffPlan
api_tp
Destinations
~~~~~~~~~~~~
.. toctree::
:maxdepth: 2
api_tpdestinations
Timings
~~~~~~~
@@ -149,6 +139,15 @@ Timings
api_tptimings
Destinations
~~~~~~~~~~~~
.. toctree::
:maxdepth: 2
api_tpdestinations
Rates
~~~~~~~
@@ -158,6 +157,15 @@ Rates
api_tprates
DestinationRates
~~~~~~~
.. toctree::
:maxdepth: 2
api_tpdestinationrates
GetTPRateTiming
SetTPRateTiming