How can I expose Time Tracking app data via the API?
- Time Tracking App must be installed and enabled
- API must be activated
1. First, you will want to find the field IDs for each of the custom ticket fields created by the time tracking app. To do this, you will go the ticket fields endpoint and searching for each of the following field names.
- Time spent last update (sec)
- Total time spent (sec)
2. Record the IDs somewhere you can easily access them.
3. Now that you have the field IDs you can use the ticket audits endpoint to gather the fields' data. The data will be recorded in seconds. Keep in mind that the audits endpoint stores the time tracking data under their field IDs, not their field names.
Note: If you just want the end-state of the time tracking values, you will need to write a script to look at the last event in the ticket audit. If you want historical information for each ticket update, you will want your script to grab the values of these fields in each event.