Recent searches
No recent searches
How to get user's time logs from API
Posted May 26, 2022
Hi all
Have reviewed similar tickets, and there seems to be no consensus on if this is possible with the API. The docs suggest it might be possible to put something together using the Metrics and Audit APIs, but I have poked around with the responses from these APIs and I can't construct anything that will give me the actual time logged by a user on a ticket.
To clarify, I am not looking for total time spent, which is already documented.
I need to extract from the API, the time spent by users on tickets. I am sure there is a way to construct this from the audit logs, but I can't see how!
Please advise and document this Zendesk!
1
6
6 comments
Ross Edwards
For the benefit of future people, I have worked around this by building a Report in Explore with the calculated metric as documented here: https://support.zendesk.com/hc/en-us/articles/4408825230490-Time-Tracking-app-metrics-you-need-to-be-measuring
I put this in a Dashboard, scheduled it to deliver as CSV to me, setup an Outlook rule to forward this to Zapier, extracted the rows into SQL server, then did my thing (send them to our time tracking system).
Very messy, but work. Would be much nicer to call the API.
1
Nicole Saunders
Thanks for sharing that workaround for others, Ross. Our Developer Support team should be along soon to respond further to your original post.
0
Erica Girges
Thanks again for sharing your solution within the Community. From taking a look at your initial request, if you're looking to calculate an agent's handling time per ticket, I would recommend taking a look at the Ticket Metric Events API. This actually allows you to measure the time allotments for specific ticket events such as time until fulfill, pause events (when tickets are in the On-Hold status), or update status change events. By being able to target specific events within the ticket you would be able to curate your calculation based on your specific needs. For example, if you only wanted to know how long an agent spent with a ticket in the Open status you would be able to get that from this endpoint.
The actual calculation would be very similar to how you set it up as a report in Explore. However, you would just be hitting the API directly rather than extracting the data from Explore. You could even create a webhook to externally initiate hitting the API. For example, you could begin calculating an agent's ticket handling time once it's been updated to solved status. You would create an automation that initiates the webhook once a ticket is in solved status. Through the webhook, you would send that ticket id and the assignee id. Then you would be able to hit the Ticket Metric Events API to calculate agent handling time.
Hope this helps!
Best,
Erica
0
Ross Edwards
Hi Erica
Thanks for your message, this makes sense, however I can't find the equivalent values in the Ticket Metric Events API that match the working example as documented for Explore.
Note I am only interested in the time logs submitted by users using the time tracking feature.
In order to create the "update handling time" metric, these docs refer to Changes - Previous value and Changes - New value attributes.
However there is no mention of these values in the API. Also I can't see any mention of the agent ID in the responses from this API, so how could I measure time longs for users?
Please can I ask for an example of how to recreate the Explore example using the API. For example, starting with the output of the Ticket Metrics Events API:
/api/v2/incremental/ticket_metric_events?start_time=1653483600
This returns a whole bunch of metrics, but nothing I can see would be useful, or relates to the Explore example. Would be really helpful if you can say exactly what metrics I need to reference in my calculation, and how I can relate this to an agent, as above.
0
Ross Edwards
OK feel free to correct me - I think we should actually be looking at the Ticket Audit Events API.
The documentation is wrong in saying that Ticket Metric Events can be used to measure agent performance, "You can use the ticket metric events API to track reply times, agent work times, and requester wait times." I don't see how this is possible.
I believe the actual data we need to calculate agent work time is in the Audit Events API.
I can call this for a ticket, and I there is a custom field with a numerica field name, which I believe is tracking the agent time logs:
/api/v2/tickets/33532/audits
"id": 6201053197201,
0
Erica Girges
Thanks for following up and pointing this out. I took a further look into the Ticket Audit Change Event and the specific metric calculations provided in the above article. It does appear that specific field value change is where the calculation is coming from for that specific example.
I'm definitely going to get in touch with our team to make sure there's more clarity in our docs and walkthrough articles.
I also truly appreciate your feedback on wanting easier access to agent work times via API. We're all for wanting to make the process as smooth as possible so I know the team will love to get this input.
Best,
Erica
0