Question
Why are Views count from the API returning randomly results with null values?
Answer
When calling the Views endpoint and requesting a count, as in /api/v2/views/count_many?ids=
or /api/v2/views/{VIEW_ID}/count.json
it can result with null
values.
{
"url": "https://{SUBDOMAIN}.zendesk.com/api/v2/views/360175165913/count.json",
"view_id": 360175165913,
"value": null,
"pretty": "...",
"fresh": false,
"refresh": "pubsub",
"channel": "view/924bf601a81d8a1be7aafb25c39eda0a999779f5/count",
"poll_wait": 30
},
The underlying cause is that the system has yet to cache the data, resulting in the "fresh"
attribute resulting a false
value.
A solution for this is to implement a backoff strategy, where the requests are sent at intervals and keep retrying after many seconds, until the value is no longer null
. It's worth mentioning that the endpoint is limited to 6 requests every 5 minutes.
For more information, see this article: Count tickets in view.
0 comments