如何使用“ reply_time_in_minutes”指标?

时间:2019-07-30 00:03:28

标签: python zendesk-api

我一直在尝试通过Zendesk API检索有关代理回复时间的数据。但是,每次我使用给定的指标“ reply_time_in_minutes”时,都会得到一个KeyError。有人对我应该做什么有建议吗?

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'])

1 个答案:

答案 0 :(得分:0)

“ reply_time_in_minutes”是您使用的not available in the incremental ticket export endpoint的票证指标。要获取指标数据,您需要“ sideloadmetric_sets using

url = 'https://domain.zendesk.com/api/v2/incremental/tickets.json? 
start_time=1563230494&include=metric_sets'