Query RE Group_Messages & In Options in Curl API Search

AI-generated summary

ddbm001 is seeking guidance on using Discourse’s Search API with the curl command to generate custom user activity reports for their internal and external customers. They want to filter search results by specific date ranges and group messages, but are having trouble getting more than one in:option to work and are not getting any results when using the group_messages: groupname option. Ideally, they want to run searches to achieve reports with topics created, replies posted, and date ranges for specific team names. Canapin suggests looking at an advanced search filters post on meta discourse for potential guidance.

Hi Team,

The enterprise that I work in has a hosted Discourse package for both Internal & External customers.

As an Admin on the Forum, I have some specific reporting functions to execute to generate Bi-weekly, Monthly and Annual user activity reports.

The fixed reporting periods (All_Time, Year, Quarter, Month, Week and Day) are useable however they are all linked to the Current_Date. Consequently I need to run specific Date_Range 01 January 20XX to 31 December 20XX reports and do so using the direct Search API and the Curl command.

Single_User reporting of Categories or a custom time range is simple however the fun begins when I attempt to use the group_messages: groupname option or multiple options in the Curl command.

The current base command that I use for all of my searches is:

curl -i -sS -X GET -G “https://discuss.domainname.com/search.json” --data-urlencode
‘q=subject @username #questions after:2021-12-31’
| tail -n 1
| jq .topics
| sed “s|: "|:"|g”
| grep slug
| cut -d “"” -f4

Then the results get Bashed and Awked etc into a .CSV for easy importing into GoogleSheets.

In the Search documents, allegedly you can use multiple options within each Options category, so I could have in:title in:likes in:seen etc however I am unable to get more than one in:option to produce a valid search.

The docs mention the use of group_messages: groupname however if I used that option in the above Curl query I get zero results, and I have tried with many of the Groups on our forum.

Ideally I would like to run Curl searches to achieve the following reports:

small_team_name | Topics_Created | Replies_Posted | Date_Range
large_team_name | Topics_Created | Replies_Posted | Date_Range

Can someone give me some guidance please on what I may be doing wrong, or suggest a better method?

Regards, DDBM001.

You might be interested in this reply: