Forum Discussion

Kev_B's avatar
Kev_B
Advisor
7 years ago

Do date constraints work with API v1?

Hi,

I'm using API v1 for the first time to pull up some user stats, and I'm trying to constrain these to a date range. I've tried using ?date_start-YYYY-MM-DD&date_end-YYYY-MM-DD at the end of the query URL, but this doesn't seem to work in sorting the results.

The one query I'm using is users/id/{user-id}/posts.

Just wondering if anybody has any experience, as the only stuff I can find about date_start / end is referring to using metrics.

  • Kev_B
    yes, start date and end date is not working here with this API. But you can do it with API V2 also. 

    Select * from messages where author.id = '123' and post_time > "date" and post_time < "date" 
    • Kev_B's avatar
      Kev_B
      Advisor

      Thanks Vikas, 

      I'm most interested in using the count function on posts, is there an easy way to do this with API v2?

      Thanks

      • VikasB's avatar
        VikasB
        Boss

        Kev_B

        a) Use the same API shared in the last comment. See here https://prnt.sc/kxz7je
        b) Use count specific API

        Select count(*) from messages where author.id = '3' and post_time > 2018-09-21T00:15:47.369-07:00