TP_TIMINGID_02 - Covers PM hours from 12pm to 11:59pm
{
"id": 1,
"method": "APIerSv1.SetTPTiming",
"params": [
{
"TPid": "TPid-01",
"ID": "TP_TIMINGID_01",
"MonthDays": "11;12;13;14;15",
"Months": "4;5;6;7",
"Time": "00:00:00;11:59:59",
"WeekDays": "*any",
"Years": "2026;2027"
}
]
}
{
"id": 1,
"result": "OK",
"error": null
}
{
"id": 1,
"method": "APIerSv1.SetTPTiming",
"params": [
{
"TPid": "TPid-01",
"ID": "TP_TIMINGID_02",
"MonthDays": "11;12;13;14;15",
"Months": "4;5;6;7",
"Time": "12:00:00;23:59:59",
"WeekDays": "*any",
"Years": "2026;2027"
}
]
}
{
"id": 2,
"result": "OK",
"error": null
}
2) Load the newly created TP Timing IDs from StorDB to DataDB
{
"id": 3,
"method": "APIerSv1.LoadTariffPlanFromStorDb",
"params": [
{
"TPid": "TPid-01",
"Validate": true
}
]
}
{
"id": 3,
"result": "OK",
"error": null
}
3) Set a new Account
{
"id": 4,
"method": "APIerSv2.SetAccount",
"params": [
{
"Account": "TEST_ACCOUNT_ID_001",
"ExtraOptions": {
"AllowNegative": false,
"Disabled": false
},
"ReloadScheduler": true,
"ActionPlanIDs": null,
"ActionPlansOverwrite": false,
"ActionTriggerIDs": null,
"ActionTriggerOverwrite": false
}
]
}
4) Set a monetary type balance for the newly created account, and assign it the two Timing ID's created above. TP_TIMINGID_01 is assigned as is, while TP_TIMINGID_02 is assigned with a bang sign "!".
{
"id": 5,
"method": "APIerSv1.SetBalance",
"params": [
{
"Account": "TEST_ACCOUNT_ID_001",
"BalanceType": "*monetary",
"Value": 20,
"Balance": {
"ID": "TEST_MONETARY_BALANCE_01",
"DestinationIDs": "DST_CA_ALL;DST_CA_TOLLFREE;DST_USA_ALL;!DST_CA_INTERNATIONAL;",
"RatingSubject": null,
"Categories": "call-in;!call-out",
"SharedGroups": null,
"TimingIDs": "TP_TIMINGID_01;!TP_TIMINGID_02",
"ExpiryTime": "*unlimited",
"Factors": null,
"Blocker": false,
"Weight": 10,
"Disabled": false
},
"ActionExtraData": null,
"Cdrlog": false
}
]
}
5) Fetch the account and its balance using method GetAccount
{
"id": 6,
"method": "APIerSv2.GetAccount",
"params": [
{
"Account": "TEST_ACCOUNT_ID_001"
}
]
}
{
"id": 6,
"result": {
"ID": "uc.hostedpbx.ca:TEST_ACCOUNT_ID_001",
"BalanceMap": {
"*monetary": [
{
"Uuid": "23a8ff9f-90cb-44d0-b386-6302df41228c",
"ID": "TEST_MONETARY_BALANCE_01",
"Value": 20,
"ExpirationDate": "0001-01-01T00:00:00Z",
"Weight": 10,
"DestinationIDs": {
"DST_CA_ALL": true,
"DST_CA_INTERNATIONAL": false,
"DST_CA_TOLLFREE": true,
"DST_USA_ALL": true
},
"RatingSubject": "",
"Categories": {
"call-in": true,
"call-out": false
},
"SharedGroups": {},
"Timings": [
{
"ID": "TP_TIMINGID_01",
"Years": [
2026,
2027
],
"Months": [
4,
5,
6,
7
],
"MonthDays": [
11,
12,
13,
14,
15
],
"WeekDays": [],
"StartTime": "00:00:00",
"EndTime": "11:59:59"
},
{
"ID": "TP_TIMINGID_02",
"Years": [
2026,
2027
],
"Months": [
4,
5,
6,
7
],
"MonthDays": [
11,
12,
13,
14,
15
],
"WeekDays": [],
"StartTime": "12:00:00",
"EndTime": "23:59:59"
}
],
"TimingIDs": {
"TP_TIMINGID_01": true,
"TP_TIMINGID_02": false
},
"Disabled": false,
"Factors": null,
"Blocker": false
}
]
},
"UnitCounters": null,
"ActionTriggers": null,
"AllowNegative": false,
"Disabled": false,
"UpdateTime": "2026-05-13T20:16:22.8805858-04:00"
},
"error": null
}
6) Using the method SetBalance again, update this same account's monetary type balance and remove the TimingIDs from it.
{
"id": 7,
"method": "APIerSv1.SetBalance",
"params": [
{
"Account": "TEST_ACCOUNT_ID_001",
"BalanceType": "*monetary",
"Balance": {
"ID": "TEST_MONETARY_BALANCE_01",
"TimingIDs": "",
"Disabled": false
},
"ActionExtraData": null,
"Cdrlog": false
}
]
}
7) Use the method GetAccount to fetch the account details again
{
"id": 8,
"method": "APIerSv2.GetAccount",
"params": [
{
"Account": "TEST_ACCOUNT_ID_001"
}
]
}
{
"id": 8,
"result": {
"ID": "uc.hostedpbx.ca:TEST_ACCOUNT_ID_001",
"BalanceMap": {
"*monetary": [
{
"Uuid": "23a8ff9f-90cb-44d0-b386-6302df41228c",
"ID": "TEST_MONETARY_BALANCE_01",
"Value": 20,
"ExpirationDate": "0001-01-01T00:00:00Z",
"Weight": 10,
"DestinationIDs": {
"DST_CA_ALL": true,
"DST_CA_INTERNATIONAL": false,
"DST_CA_TOLLFREE": true,
"DST_USA_ALL": true
},
"RatingSubject": "",
"Categories": {
"call-in": true,
"call-out": false
},
"SharedGroups": {},
"Timings": [
{
"ID": "TP_TIMINGID_01",
"Years": [
2026,
2027
],
"Months": [
4,
5,
6,
7
],
"MonthDays": [
11,
12,
13,
14,
15
],
"WeekDays": [],
"StartTime": "00:00:00",
"EndTime": "11:59:59"
},
{
"ID": "TP_TIMINGID_02",
"Years": [
2026,
2027
],
"Months": [
4,
5,
6,
7
],
"MonthDays": [
11,
12,
13,
14,
15
],
"WeekDays": [],
"StartTime": "12:00:00",
"EndTime": "23:59:59"
}
],
"TimingIDs": {},
"Disabled": false,
"Factors": null,
"Blocker": false
}
]
},
"UnitCounters": null,
"ActionTriggers": null,
"AllowNegative": false,
"Disabled": false,
"UpdateTime": "2026-05-13T20:30:39.717866863-04:00"
},
"error": null
}
In the GetAccount response back above, "TimingIDs" is now an empty object, which would mean to me that the two TimingID's we originally assigned to the account are no longer assigned to the account anymore. But the "Timings" array in the same response still shows the expanded version of those two TimingIDs. Is this normal? Will the account balance still take into account the two TimingIDs despite the fact that they've been removed from the account? How do I remove these leftover "Timings"?
Once a TP TimingID is set in StorDB, and loaded into DataDB, and then assigned to one or more accounts, if I need to update the values in that TimingID, how do I do that? Can I just update the same TP TimingID in StorDB first, and load it into DataDB again? Will this automatically update all the account balances (Don't think so but just want to confirm) that were already using that TimingID? OR do I need to repeat the same process of creating a brand new TP TimingID with the updated values in StorDB, load it into DataDB, and remove the existing TimingID from all the account balances using that TimingID, and then assign the newly created/loaded TimingID?
In step 4 above, when SetBalance is used to set a new balance:
- TP_TIMINGID_01 is assigned as is, while TP_TIMINGID_02 is assigned with a bang sign "!" in front of it. Would this mean that this balance will only be used when the actual time falls between TP_TIMINGID_01 and it will not match when the actual time falls between TP_TIMINGID_02?
- Same question for other properties in there, like "DestinationIDs", "RatingSubject", "Categories", "SharedGroups". A bang sign "!" can be used in front of one or more of the string values of these properties to inverse match and it'll behave as a logical NOT when this balance is queried, right?
Thanks,