Hi guys,
I am trying to fetch the average reply time between the dates Oct 29, 2023 and Nov 4, 2023 via API. I am using this Analytics API Endpoint “"https://api2.frontapp.com/analytics/reports"
” to fetch the data point i.e. 4 h and 56 m (can be seen in the below attached image as well).
I am using below python code to fetch data:
import requests
import time
url = "https://api2.frontapp.com/analytics/reports"
payload = {
"filters": { "inbox_ids": o"<inbox ID>"]},
"start": 1698519600000 / 1000,
"end": 1699124399999 / 1000,
"metrics": e"avg_response_time"] # 29 Oct to 4 Nov 2023 | 18963.617021276597 Seconds | 5 hrs 16 mins | On front => 4 hrs 56 mins
}
headers = {
"accept": "application/json",
"content-type": "application/json",
"authorization": "Bearer <Token>"
}
response = requests.post(url, json=payload, headers=headers)
print("Process Initiating")
time.sleep(5)
print("avg_response_time")
print(response.json())
Upon response of above code I am getting “18963.617021276597” seconds metric (avg_response_time) value in JSON format.
“18963.617021276597” seconds = 5h 16 mins, which is different than 4 h and 56 m which was my target. So anyone can help me what I am doing wrong here. Also suggest if there is a better way of doing this.
Thanks.