Skip to content

Commit

Permalink
docs(messaging-stats): add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
DavisRayM committed Apr 19, 2023
1 parent af99c0e commit 64f478a
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ Event tracking and messaging (Beta)
:maxdepth: 2

messaging
messaging_stats

Ona Tagging API
~~~~~~~~~~~~~~~
Expand Down
40 changes: 40 additions & 0 deletions docs/messaging_stats.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Messaging Stats
****************

Provides a count of each unique messaging event grouped by either day, month or year.

The endpoint accepts the following *required* query parameters:

* *group_by* - field specifying whether to group events by day, month or year.

* *target_type* - field to be used to determine the target object type i.e xform

* *target_id* - field used to identify the target object.

* *verb*: field used to filter returned responses by a specific verb

* *timestamp*: used to filter by actions that occurred in a specific timeframe. This query parameter support date time lookups i.e `timestamp__day`, `timestamp__year

Example
^^^^^^^^
::

GET /api/v1/stats/messaging?target_id=1&target_type=xform&group_by=year

Response
^^^^^^^^^
::

[
{
"submission_edited": 5,
"submission_created": 10,
"group": "2023"
},
{
"submission_edited": 1043,
"submission_created": 5023,
"submission_deleted": 200,
"group": "2022"
},
]
4 changes: 2 additions & 2 deletions onadata/apps/api/viewsets/messaging_stats_viewset.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

class MessagingStatsViewSet(mixins.ListModelMixin, viewsets.GenericViewSet):
"""
Provides a count of each unique messaging event grouped by a specified
field.
Provides a count of each unique messaging event grouped by either day, month
or year.
The endpoint accepts the following query parameters:
Expand Down

0 comments on commit 64f478a

Please sign in to comment.