API: RatingProfiles, RatingPlane, DestinationRates, Rates [set, get, remove]

196 views
Skip to first unread message

Miroslav Pejic

unread,
Feb 22, 2018, 7:51:44 AM2/22/18
to CGRateS
Hi Dan,


I need to querry dataDB ( online Database )

I try to set, get and remove:

RatingProfiles

RatingPlane,

DestinationRates

Rates 

but not found api, or can you help me where is? :)

```
{"method": "ApierV1.________________",
    "params": [{

    }]
}
```

Thanks

DanB

unread,
Feb 22, 2018, 8:20:45 AM2/22/18
to cgr...@googlegroups.com
Hi Miroslav,

Since we compile data, not all the data types which you find in
.csv/StorDB can be found in the same format in DataDB. Hence the
missing APIs (for data which does not exist.
However RatingPlans, RatingProfiles and Destinations should have APIs
in v1/v2.

DanB
> --
> You received this message because you are subscribed to the Google
> Groups "CGRateS" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to cgrates+u...@googlegroups.com.
> To post to this group, send email to cgr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/cgrates/877a8af4-615c-4ce4-bd4d-250b7e9fd35e%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.

Miroslav Pejic

unread,
Feb 22, 2018, 9:28:24 AM2/22/18
to CGRateS

Dan, 

I found only this:


RatingPlans Nothing.

RatingProfiles:
func (self *ApierV1) GetTPRatingProfilesByLoadId(attrs utils.TPRatingProfile, reply *[]*utils.TPRatingProfile) error

Destinations: ?
func (v1 *ApierV1) ComputeReverseDestinations(ignr string, reply *string) (err error)



RatingPlans Nothing.

RatingProfile Nothing.

Destinations:
func (self *ApierV2) GetDestinations(attr AttrGetDestinations, reply *[]*engine.Destination) error
func (self *ApierV2) GetTPDestination(attrs AttrGetTPDestination, reply *utils.TPDestination) error
func (self *ApierV2) RemTPDestination(attrs AttrGetTPDestination, reply *string) error
func (self *ApierV2) SetTPDestination(attrs utils.TPDestination, reply *string) error


I need for RatingProfiles, RatingPlane, DestinationRates, Rates like this:

set Account + ActionPlans OK
```
{"method": "ApierV1.SetAccount",
    "params": [{
         "Tenant": "miro.it", 
         "Account": "0409828061", 
         "ActionPlanId": "ACP_061", 
         "ActionTriggersId": "", 
         "AllowNegative": true,
         "Disabled": false,
         "ReloadScheduler": false 
    }]
}
```
get Accounts OK

```
{"method": "ApierV1.GetAccounts",
    "params": [{
            "Tenant": "miro.it",
            "AccountIds": ["0409828061"],
            "Offset": 0,
            "Limit": 0
    }]
}
```
Remove Account OK
```
{"method": "ApierV1.RemoveAccount",
    "params": [{
         "Tenant": "miro.it", 
         "Account": "0409828061", 
          "ReloadScheduler": false
    }]
}
```

Thanks

DanB

unread,
Feb 22, 2018, 10:02:24 AM2/22/18
to cgr...@googlegroups.com
Miroslav,

If you are dealing with DataDB, you should ignore TP* APIs. They work
with offline DB/StorDB.

DanB
> msgid/cgrates/f0f418cb-bed3-4edf-b861-286fa37a0157%40googlegroups.com

Miroslav Pejic

unread,
Feb 22, 2018, 10:17:56 AM2/22/18
to CGRateS
Dan, right but not found api can you help me to found one of this for example [set, get, remove] ? :)


RatingProfilesNothing. i need set, get remove

RatingPlans Nothing. i need set, get, remove

DestinationRates Nothing need set, get, remove

Rates  Nothing need set, get, remove



RatingProfile Nothing. i need set, get remove

RatingPlans Nothing. i need set, get remove

DestinationRates Nothing need set, get, remove

Rates Nothing need set, get, remove

DanB

unread,
Feb 22, 2018, 10:35:35 AM2/22/18
to cgr...@googlegroups.com
Hi Miroslav,

There are APIs related your queries (not all of them due to reasons I
have written previously).
Please try to review them one by one and ask your questions related
specific one.

Thanks,
DanB
> msgid/cgrates/a730eb32-bcb5-4c8f-b357-77e971af67e4%40googlegroups.com

Miroslav Pejic

unread,
Feb 23, 2018, 3:19:20 AM2/23/18
to CGRateS
Hi Dan,
ok sorry, in order 
1) I Need to create Rating Profile trought API, is that possible?

```
#Direction,Tenant,Category,Subject,ActivationTime,RatingPlanId,RatesFallbackSubject,CdrStatQueueIds
*out,miro.it,call,0409828070,2014-01-14T00:00:00Z,RP_DEFAULT,,
```
Miroslav

DanB

unread,
Feb 23, 2018, 3:39:47 AM2/23/18
to cgr...@googlegroups.com
Hi Miroslav,

Did u have a look to the API folder? By quick search I got this one:
https://godoc.org/github.com/cgrates/cgrates/apier/v1#ApierV1.SetRating
Profile

DanB

On Fri, 2018-02-23 at 00:19 -0800, Miroslav Pejic wrote:
> Hi Dan,
> msgid/cgrates/47674827-01f6-4e61-9c9c-1330e705b40f%40googlegroups.com

Miroslav Pejic

unread,
Feb 23, 2018, 3:56:20 AM2/23/18
to CGRateS
DanB, sorry my mistike.

i Not found get and remove RatingProfile! :)

I reformulate the question:
1) I Need to GET or REMOVE a Rating Profile trought API, is that possible?

Thanks
Selection_037.png

DanB

unread,
Feb 23, 2018, 3:59:39 AM2/23/18
to cgr...@googlegroups.com
Miroslav,

Another quick search:
https://godoc.org/github.com/cgrates/cgrates/apier/v1#ApierV1.RemoveRat
ingProfile

There is no GetRatingProfile, you can create an issue on github for it
and we can add it if you need it.

DanB
> > > > > > > msgid/cgrates/f0f418cb-bed3-4edf-b861-
> > > > > > 286fa37a0157%40googlegroups.com
> > > > > > > .
> > > > > > > For more options, visit https://groups.google.com/d/optou
> > t.
> > > > >
> > > > > --
> > > > > You received this message because you are subscribed to the
> > > > Google
> > > > > Groups "CGRateS" group.
> > > > > To unsubscribe from this group and stop receiving emails
> > from
> > > > it,
> > > > > send an email to cgrates+u...@googlegroups.com.
> > > > > To post to this group, send email to cgr...@googlegroups.com.
> >
> > > > > To view this discussion on the web visit https://groups.googl
> > e.co
> > > > m/d/
> msgid/cgrates/67847d7b-894d-4388-82e5-730dfabffb14%40googlegroups.com

Miroslav Pejic

unread,
Feb 23, 2018, 4:12:37 AM2/23/18
to CGRateS
Dan, 
Ok, So continue:
2)  I Need to create and remove RatingPlan trought API, is that possible? 
Thanks

DanB

unread,
Feb 23, 2018, 4:16:46 AM2/23/18
to cgr...@googlegroups.com
Miroslav,

Since RatingPlan can be pretty big (had cases of 350MB), there is no
API to set it directly. The right way to create it via APIs is via TP*
APIs and load in the end.

The TP* APIs were designed as complete set to manage your data
remotely.

DanB

On Fri, 2018-02-23 at 01:12 -0800, Miroslav Pejic wrote:
> Dan,
> > > > > > > > > msgid/cgrates/f0f418cb-bed3-4edf-b861-
> > > > > > > > 286fa37a0157%40googlegroups.com
> > > > > > > > > .
> > > > > > > > > For more options, visit https://groups.google.com/d/o
> > ptou
> > > > t.
> > > > > > >
> > > > > > > --
> > > > > > > You received this message because you are subscribed to
> > the
> > > > > > Google
> > > > > > > Groups "CGRateS" group.
> > > > > > > To unsubscribe from this group and stop receiving emails
> > > > from
> > > > > > it,
> > > > > > > send an email to cgrates+u...@googlegroups.com.
> > > > > > > To post to this group, send email to cgr...@googlegroups.
> > com.
> > > >
> > > > > > > To view this discussion on the web visit https://groups.g
> > oogl
> > > > e.co
> > > > > > m/d/
> > > > > > > msgid/cgrates/a730eb32-bcb5-4c8f-b357-
> > > > > > 77e971af67e4%40googlegroups.com
> > > > > > > .
> > > > > > > For more options, visit https://groups.google.com/d/optou
> > t.
> > > > >
> > > > > --
> > > > > You received this message because you are subscribed to the
> > > > Google
> > > > > Groups "CGRateS" group.
> > > > > To unsubscribe from this group and stop receiving emails
> > from
> > > > it,
> > > > > send an email to cgrates+u...@googlegroups.com.
> > > > > To post to this group, send email to cgr...@googlegroups.com.
> >
> > > > > To view this discussion on the web visit https://groups.googl
> > e.co
> > > > m/d/
> msgid/cgrates/56213e44-e0da-4887-8829-de496de0c97b%40googlegroups.com

Miroslav Pejic

unread,
Feb 23, 2018, 4:40:06 AM2/23/18
to CGRateS
DanB, Aha 
I assume then it's the same for Destination Rates ...
3) I need to remove a ActionPlan trought API, is that possible? 

i found  :

DanB

unread,
Feb 23, 2018, 5:31:15 AM2/23/18
to cgr...@googlegroups.com
Hi Miroslav,

This is an old API for removing action plan. You can use it in the mean
time and maybe add an issue so we can create one with proper naming:
https://godoc.org/github.com/cgrates/cgrates/apier/v1#AttrRemActionTimi
ng

DanB
> > > > > > > > > msgid/cgrates/a730eb32-bcb5-4c8f-b357-
> > > > > > > > 77e971af67e4%40googlegroups.com
> > > > > > > > > .
> > > > > > > > > For more options, visit https://groups.google.com/d/o
> > ptou
> > > > t.
> > > > > > >
> > > > > > > --
> > > > > > > You received this message because you are subscribed to
> > the
> > > > > > Google
> > > > > > > Groups "CGRateS" group.
> > > > > > > To unsubscribe from this group and stop receiving emails
> > > > from
> > > > > > it,
> > > > > > > send an email to cgrates+u...@googlegroups.com.
> > > > > > > To post to this group, send email to cgr...@googlegroups.
> > com.
> > > >
> > > > > > > To view this discussion on the web visit https://groups.g
> > oogl
> > > > e.co
> > > > > > m/d/
> > > > > > > msgid/cgrates/47674827-01f6-4e61-9c9c-
> > > > > > 1330e705b40f%40googlegroups.com
> > > > > > > .
> > > > > > > For more options, visit https://groups.google.com/d/optou
> > t.
> > > > >
> > > > > --
> > > > > You received this message because you are subscribed to the
> > > > Google
> > > > > Groups "CGRateS" group.
> > > > > To unsubscribe from this group and stop receiving emails
> > from
> > > > it,
> > > > > send an email to cgrates+u...@googlegroups.com.
> > > > > To post to this group, send email to cgr...@googlegroups.com.
> >
> > > > > To view this discussion on the web visit https://groups.googl
> > e.co
> > > > m/d/
> msgid/cgrates/7a71c19a-9a71-400f-80b5-949f9c94e6dc%40googlegroups.com

Miroslav Pejic

unread,
Feb 23, 2018, 5:48:35 AM2/23/18
to CGRateS
Dan,
Ok, You mean this:
and open issue to rename to:

4) I need to create , get and remove Rates trought API, is that possible?
I not found any API about it.
Thanks 

DanB

unread,
Feb 23, 2018, 5:55:22 AM2/23/18
to cgr...@googlegroups.com
Miroslav,

Yes, you can use RemActionTiming to remove an ActionPlan and yes,
please create an issue to rename the API (or create a new one).

Regarding Rates, they are not standalone in DataDB (they are part of
RatingPlan).

DanB

On Fri, 2018-02-23 at 02:48 -0800, Miroslav Pejic wrote:
> Dan,
> Ok, You mean this:
> https://godoc.org/github.com/cgrates/cgrates/apier/v1#ApierV1.RemActi
> onTiming
> > > > > > > > > msgid/cgrates/47674827-01f6-4e61-9c9c-
> > > > > > > > 1330e705b40f%40googlegroups.com
> > > > > > > > > .
> > > > > > > > > For more options, visit https://groups.google.com/d/o
> > ptou
> > > > t.
> > > > > > >
> > > > > > > --
> > > > > > > You received this message because you are subscribed to
> > the
> > > > > > Google
> > > > > > > Groups "CGRateS" group.
> > > > > > > To unsubscribe from this group and stop receiving emails
> > > > from
> > > > > > it,
> > > > > > > send an email to cgrates+u...@googlegroups.com.
> > > > > > > To post to this group, send email to cgr...@googlegroups.
> > com.
> > > >
> > > > > > > To view this discussion on the web visit https://groups.g
> > oogl
> > > > e.co
> > > > > > m/d/
> > > > > > > msgid/cgrates/67847d7b-894d-4388-82e5-
> > > > > > 730dfabffb14%40googlegroups.com
> > > > > > > .
> > > > > > > For more options, visit https://groups.google.com/d/optou
> > t.
> > > > >
> > > > > --
> > > > > You received this message because you are subscribed to the
> > > > Google
> > > > > Groups "CGRateS" group.
> > > > > To unsubscribe from this group and stop receiving emails
> > from
> > > > it,
> > > > > send an email to cgrates+u...@googlegroups.com.
> > > > > To post to this group, send email to cgr...@googlegroups.com.
> >
> > > > > To view this discussion on the web visit https://groups.googl
> > e.co
> > > > m/d/
> msgid/cgrates/eb06bd76-8dc1-4482-a658-c10c36e3a49f%40googlegroups.com

Miroslav Pejic

unread,
Feb 26, 2018, 5:23:21 AM2/26/18
to CGRateS
Since RatingPlan can be pretty big (had cases of 350MB), there is no 
API to set it directly. The right way to create it via APIs is via TP* 
APIs and load in the end.

The TP* APIs were designed as complete set to manage your data 
remotely.
```
Not understand this, when i use cgr-loader to load all my csv config, also RatingPlan.
All data is loaded on dataDb. With RatingPlan can be pretty big, what you mean?

I found also this API:
this not exsist:
Reply all
Reply to author
Forward
0 new messages