I've been trying to retrieve data on the reply time of my agents through the Zendesk API. However, every time I use the given metric "reply_time_in_minutes" I get a KeyError. Does anyone have suggestions on what I should do?
import requests
# Set the request parameters
url = 'https://domain.zendesk.com/api/v2/incremental/tickets.json?
start_time=1563230494'
user = 'email' + '/token'
pwd = 'token'
# Do the HTTP get request
response = requests.get(url, auth=(user, pwd))
# Check for HTTP codes other than 200
if response.status_code != 200:
print('Status:', response.status_code, 'Problem with the request.
Exiting.')
exit()
# Decode the JSON response into a dictionary and use the data
data = response.json()
ticket_list1 = data['tickets']
for ticket1 in ticket_list1:
print(ticket1['reply_time_in_minutes'])