Use this article to understand the steps to using the Customer API to find tickets closed by a user.
Fetch your apex users
The first step towards pulling data for your team members is to use the Users endpoint to find the apex user IDs for the users in the team. When multiple user records are associated with an individual, user records are merged under a single apex user record. The call below gets you a list of apex user IDs and the associated names for everyone in the team.
- YOUR_TEAM_NAME: This is the Flow team you are interested in. Of course you can use the users API to grab a different set of data, if that’s what you’re looking for.
-
HOSTNAME: This is the IP address or URL for the Flow application. If you’re using the cloud instance of Flow, this will be
flow.pluralsight.com
. If you’re using Flow Enterprise Server, this will be something other thanflow.pluralsight.com
. - Format: This creates a CSV file of the results. Your implementation would likely use .json or another format.
Your results will look something like this:
id,name
2081995,Sally Smith
1905302,Jessica Jones
2069030,Sam Scales
Get all the sub aliases associated to that group
Once you have your list of apex users, find the sub-aliases that might be assigned to tickets.
Use this call to get the user data you need:
- HOSTNAME : Use the same hostname as you used previously.
-
YOUR_USER_LIST: This list of user IDs that you got previously. It should be comma separated.
apex_user_id__in=2081995,1905302,2069030
The results here will be a much longer list that shows a complete list of users that your tickets may be logged under. It also shows a mapping to the main apex User ID.
id,apex_user_id
2008481,2064975
2008482,2064975
2009588,1260734
2084711,2081995
2099206,1260734
Get your tickets
Once you have your complete list of users, you are ready to go and grab your tickets!
Use this call to get the ticket data you need:
- HOSTNAME : Use the same hostname as you used previously.
-
State: Your definition of state and closed may be different than this. It may be fine to just have a closed date and leave this out. Or you can use this API call to see what states you have:
https://HOSTNAME/v3/customer/core/tickets.agg/?aggregate[count]=id&state=Done&group_by[state] -
Complete_user_list: this is the complete list that you got by finding all sub-aliases, as a comma delimited list. In tickets, authors are stored in the assignee field.
&assignees__in = 2081995,1905302,2069030
-
YYYY-MM-DD: This is the date range that you’re interested in. Looking for June 2023, you would use:
&closed_at__gt=2023-06-01&closed_at__lt=2023-07-01
Tips:
- This request limits the results set to 1000 records. If you have more than 1000 records to return, use the pagination feature to find the remaining pages of results.
Use aggregation for summary data
If you’re looking for summary data, you can use our aggregation features to get a count of tickets closed by month by user.
- HOSTNAME: Use the same hostname as you used previously.
- State: Use whichever closed or done states you used before
-
Complete_user_list: This is the complete list that you used before, as a comma delimited list. In tickets, users are stored in the assignee field.
&assignees__in = 2081995,1905302,2069030
-
YYYY-MM-DD: This is the date range that you’re interested in. Looking for June 2023, you would use:
&closed_at__gt=2023-06-01&closed_at__lt=2023-07-01
Put it all together
Now you have everything you need. It’s time to put it all together. You should have data sets that look something like this:
- Join Step 1 data to Step 2 data on ID to get a list of user aliases, apex users, and names.
- Join that data set you got in A to your Step 3 Data
- Roll that up by apex_user_id and you have data you can use to see how many tickets were closed by a user.