Forum Discussion

jordanepotter's avatar
9 years ago

Help with API time

I am trying to get some daily metrics using the API using calls similar to this: Communiry/metrics/name/metric/history/daily?date_start=2016-05-01&date_end=2016-05-02.

 

Looking at the data it appears that the numbers returned are based on the start and end of a day in the pacific time zone. The default/ chosen community time for the user making the call are both central. Also, since LSI gives numbers back in UTC time, these are not uniform, and throw our numbers off a little. I tried changing the time zone for the user making the call, and it does not seem to change API time settings. Is there a way we could either change our time setting to Central, or to match LSI and do UTC?

4 Replies

  • jordanepotter's avatar
    jordanepotter
    Mentor
    9 years ago
    How do you then apply the timezone settings to an api v1 call that has a start and end date?
  • DennisK's avatar
    DennisK
    Ace
    9 years ago

    We are in a similar situation, but with API v2. There does not seem to be a documented way of changing the default time zone that is returned in any API call. We tried updating the default profile time zone but that doesn't seem to change anything for the API responses. 

     

    Is there a way to change the default time zone for API v2 responses?

  • erjames5's avatar
    erjames5
    Expert
    9 years ago

    Have you guys tried making your API calls with the time zone offset in your date parameters?  Instead of passing a separate parameter for the time zone try this:

     

    /restapi/vc/metrics/name/posts/history/daily?date_start=2016-01-05T00:00:00-05:00&date_end=2016-01-05T23:59:00-05:00