Legacy Dev Forum Posts

 View Only

Sign Up

GetBillingReportsBillableusage timing out (failing) when using full DateTime

  • 1.  GetBillingReportsBillableusage timing out (failing) when using full DateTime

    Posted 06-05-2025 18:05

    ottoflux | 2019-07-02 15:07:06 UTC | #1

    So this is odd.

    Whatever the SDK is doing with DateTime is not quite right.

    If I use DateTime.Now as the end date and that + (-1) days for the start, it chokes. If I new up a DateTime with just year, month, and day it works great.

    var runtime = DateTime.Now;

    BillingUsageReport billableUsage; ... billableUsage = billingAPI.GetBillingReportsBillableusage(runtime.AddDays(days * -1), runtime); //billableUsage = billingAPI.GetBillingReportsBillableusage(new DateTime(2019,6,30), new DateTime(2019,07,01)); ...

    Thoughts?


    ottoflux | 2019-07-02 15:06:41 UTC | #2

    This is what I'm getting when it fails:

    {"status":504,"code":"gateway.timeout","message":"The request timed out.","details":[],"errors":[]}


    tim.smith | 2019-07-02 16:28:53 UTC | #3

    A 504 doesn't indicate a problem with your request. Does that happen every time or did you just see it once? Can you provide a correlation ID from the response?


    ottoflux | 2019-07-02 16:32:44 UTC | #4

    Every time with the use of DateTime.Now - I'll see if I can grab one in debug.


    ottoflux | 2019-07-02 16:48:51 UTC | #5

    {[ININ-Correlation-Id, db11a8ea-322a-4c81-89ff-2e7ca8d503fe]}

    Here you go.


    ottoflux | 2019-07-02 18:05:25 UTC | #6

    Bonus round - it seems to be issues with the dateTime being now on the end dateTime. (int days = 1; for this example)

    billableUsage = billingAPI.GetBillingReportsBillableusage(new DateTime(startTime.Year,startTime.Month,startTime.Day), new DateTime(endtime.Year, endtime.Month, endtime.Day));

    this will succeed with:

    var endtime = DateTime.Now.AddDays(-1); var startTime = endtime.AddDays(days * -1);

    but fail with:

    var endtime = DateTime.Now; var startTime = endtime.AddDays(days * -1);

    :thinking:


    ottoflux | 2019-07-02 18:14:55 UTC | #7

    Hmm - what I posted above is correct, but if I bump days to 2, it times out again.


    tim.smith | 2019-07-03 20:16:33 UTC | #8

    Thanks for the correlation ID. The 504 is being caused by the backend billing service. Please open a case with PureCloud Care to investigate further.


    ottoflux | 2019-07-03 20:20:18 UTC | #9

    Will do.

    Thanks.


    system | 2019-08-03 20:20:18 UTC | #10

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 5475