Solved

API 'statistics' date filter

  • 21 February 2018
  • 3 replies
  • 75 views

Userlevel 4
Badge +2
  • Ready to inSpire others
  • 19 replies
Can I filter the statistics by date?

Basically I want to know how many topics etc per community (we have 3) on a weekly/monthly basis. The analytics in control only show me one community so to see all 3 I need to build something separately.
icon

Best answer by Maryam 21 February 2018, 16:04

Hi Lorna,

This is indeed possible by our API; I can suggest you two different ways to build it:
  1. Statistics object: You can fetch the community statistics by a GET /statistics call. However, it is not possible to filter the result based on date and it returns the total number of topics. If you store the data in your own CMS however, by the weekly/monthly difference of total topics you can indicate the number of new topics in that specific week/month.
  2. Thread object: You can also get all the topics created in a certain time period by: GET /thread?filter[t.dateline ][from]=123&filter[t.dateline ][to]=456. You can read the total number of topics created in the 'count' parameter.
Hopefully one of the options will suit your purpose.
View original

3 replies

Userlevel 3
Hi Lorna,

This is indeed possible by our API; I can suggest you two different ways to build it:
  1. Statistics object: You can fetch the community statistics by a GET /statistics call. However, it is not possible to filter the result based on date and it returns the total number of topics. If you store the data in your own CMS however, by the weekly/monthly difference of total topics you can indicate the number of new topics in that specific week/month.
  2. Thread object: You can also get all the topics created in a certain time period by: GET /thread?filter[t.dateline ][from]=123&filter[t.dateline ][to]=456. You can read the total number of topics created in the 'count' parameter.
Hopefully one of the options will suit your purpose.
Userlevel 4
Badge +2
@Maryam do you have an example of the dates using the php wrapper? I don't get any errors but I don't get any response data and I would expect some...
Userlevel 4
Badge +2
Aaaan ignore me - I was being an idiot. 🤓

Reply