API guide: Tickets closed by an individual

Tags: Flow

Overview

This step-by-step document is intended to help you through the API calls necessary to get you on your way to reporting on tickets closed by a user.

Step 1: Fetch your apex users

The first step towards pulling data for your team is to use the users endpoint to grab the apex user ID’s for the users in the team. When multiple user records are associated with an individual, due to differences in email or variations in a name for example, user records can be "merged" under a single apex user record. The call below gets you a list of apex user id’s and the associated names for everyone in the team.

https://HOSTNAME/v3/customer/core/users/?limit=1000&team__name=YOUR_TEAM_NAME&fields=id,name,&format=csv
  • 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 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 an on-premise version of Flow, this will be something other than flow.pluralsight.com.
  • Format: creating comma delimited output for the sake of this document. Your implementation would likely use .json.

Your results will look something like this:

id,name
2081995,Sally Smith
1905302, Jessica Jones
2069030, Sam Scales

Step 2: Get all the “sub aliases” associated to that group

Once you have your list of apex users ( user_list ), you need to grab the sub-aliases that might be assigned to tickets.

Use this call to get the user data you need:

https://HOSTNAME/v3/customer/core/user_alias/?limit=1000&apex_user_id__in=YOUR_USER_LIST&fields=id,apex_user&format=csv
  • HOSTNAME : Use the same hostname as you used in Step 1.
  • YOUR_USER_LIST: This list of user ID’s that you got from Step 1. It should be comma separated.
    • &apex_user_id__in=101,102,445

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

Step 3: Get your tickets

Once you have your complete list of users (complete_user_list ), you are ready to go and grab your tickets!

Use this call to get the ticket data you need:

https://HOSTNAME/v3/customer/core/tickets/?state=Done&assignees__in=[complete_user_list]&closed_at__gt=YYYY-MM-DD&closed_at__lt=YYYY-MM-DD
  • HOSTNAME : Use the same hostname as you used in Step 1.
  • 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 in step 2, comma delimited. In tickets, authors are stored in the assignee field.
    • &assignees__in = 121,111,113,993
  • YYYY-MM-DD: This is the date range that you’re interested. Looking for June 2018, you would use:
    • &closed_at__gt=2018-06-01&closed_at__lt=2018-07-01

Couple gotchas:

  • This request limits the results set to 1000 records. If you have more than 1000 records to return, use the pagination feature to grab the remaining pages of results. Learn more about pagination!
  • When this is completed, go back and join this through the mapping that you got in step 2 to get the unique, apex user.

Step 3a: Use aggregation for summary data

If you’re looking for summary data, you can use our aggregation features. Check-out the full API documentation for more information, but here is how you would get a count of tickets closed by month by user.


https://HOSTNAME /v3/customer/core/tickets.agg/?state=Done&assignees__in= complete_user_list&closed_at__gt=YYYY-MM-DD&closed_at__lt=YYYY-MM-DD&aggregate[count]=id&group_by[assignees,closed_at__month,closed_at__year]
  • HOSTNAME: Use the same hostname as you used in Step 1.
  • State: See Step 3 for guidance.
  • Complete_author_list: This is the complete list that you got in step 2, comma delimited. In tickets, users are stored in the assignee field.
    • &assignees__in = 121,111,113,993
  • YYYY-MM-DD: This is the date range that you’re interested. Looking for June 2018, you would use:
    • &closed_at__gt=2018-06-01&closed_at__lt=2018-07-01

When this is completed, go back and join this through the mapping that you got in Step 2 to get the unique, apex user.

Step 4: 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:

A: Join Step 1 Data to Step 2 data on ID to get a list of user aliases, apex users, and names.

B: Join that data set you got in A to your Step 3 Data.


C. Roll that up by apex_user_id and, voila, you have data you can use.


back to top


If you need help, please email support@pluralsight.com for 24/7 assistance.