[Spce-user] API not accepting (valid?) billing fee value

Mark van Herpen mark at cambrium.nl
Fri Apr 8 05:13:08 EDT 2016


Hello,

I'm pretty sure this is a bug, wich is still not fixed. Tested it in 
3.8.5 LTS and 4.2.1

Json posted:
{
"id":null,
"billing_profile_id":1,
"billing_zone_id":2,
"destination":"^31",
"direction":"out",
"offpeak_follow_interval":1,
"offpeak_follow_rate":"0.0000667",
"offpeak_init_interval":1,
"offpeak_init_rate":0,
"onpeak_follow_interval":1,
"onpeak_follow_rate":"0.0000667",
"onpeak_init_interval":1,
"onpeak_init_rate":0,
"source":".",
"use_free_time":false
}

The API returns 422 as an error, the logfile:

INFO: IP=192.168.28.244 CALLED=API[POST 422]/api/billingfees/ 
TX=144356FB9D4CF8A0 USER=phpapi DATA={} MSG="" 
LOG="{"message":"Validation failed. field='onpeak_follow_rate', 
input='6.67e-05', errors='Must be a number. May contain numbers, +, - 
and decimal separator '.''; field='offpeak_follow_rate', 
input='6.67e-05', errors='Must be a number. May contain numbers, +, - 
and decimal separator '.''","code":"422"}

Kind regards,

Mark van Herpen

On 24-12-15 10:36, Mark van Herpen wrote:
> Hello,
>
> I'm trying to update the offpeak_follow_rate of a single billing fee via
> the API.
>
> I'm sending this in the PUT method:
>
> -snip-
> "offpeak_follow_rate": 6.669999999999999e-5,
> -snip-
>
> The value is not a string, but a float type. This is 0.0000667 but in
> scientific notation: 6.669999999999999e-5
>
> The error I get in the logs is:
> field='offpeak_follow_rate', input='6.67e-05', errors='Must be a number.
> May contain numbers, +, - and decimal separator '.''","code":"422"
>
> According to my knowledge json should allow 6.669999999999999e-5 as a
> valid number, but the API isn't allowing this.
>
> Is this a bug? Feature? Or am I doing something wrong?
>
> I'm using 3.8.4 LTS.
>
> Kind regards,
>
> Mark van Herpen
> _______________________________________________
> Spce-user mailing list
> Spce-user at lists.sipwise.com
> https://lists.sipwise.com/listinfo/spce-user




More information about the Spce-user mailing list