roger | 2021-05-17 21:00:21 UTC | #1
We had a daily job that did a POST query to https://api.mypurecloud.com/api/v2/analytics/users/details/query. To prevent large data returns, it the body of the query was {"interval": "2021-05-10T01:01:10Z/2021-05-11T01:01:10Z","paging": {"pageSize": 100,"pageNumber": "01"},"order":"asc"}
where our query incremented the pageNumber by one, until a return code of null was returned or an error value.
Sometime in May12, the behaviour of the api changed. With every response, there was an added response {"totalHits":2220} (in our example, 2220 values, so we would get data for 22.2 pages from the pagesize=100. When the query tried to got pageNumber 23, 24 25 or higher, the response would still be {"totalHits":2220}
This would happen until the page number climbed higher and higher unti we got the error message
context.error_message:{"message":"Pagination may not exceed 100000 results. Tip: When extracting large chunks of data (multiple days/weeks), maximize pagination performance by querying in smaller intervals. For example, paging through 1am-2am, then 2am-3am, then 3am-4am, and so forth will outperform paging through one large interval that covers the same time frame.","code":"bad.request","status":400,"messageParams":{},"contextId":"682573a6-30d1-4d3c-9b57-7def3e491a23","details":[],"errors":[]}
We're now changing our query to now retrieve totalHits/pagesize, and increment pageNumber so we don't go past the max records available.
Was last week's change expected, and should our new solution work - ie no other imminent changes expected in this api's behaviour?
peter.westermann | 2021-05-18 12:40:20 UTC | #2
totalHits is a new field that has just been released. It's purely informational and contains the approximate total number of records that match the query. This does not change paging behavior. The pagination size limit has been in place for a long time.
Paul_Ammirata | 2021-05-19 19:47:50 UTC | #3
@peter.westermann - Thanks for the information. Prior to the introduction of totalHits we had been testing for the end of data by testing if $reponse.entity == {}. Our code broke with the introduction of totalHits. We're adapting our code as needed. Our management is asking how did we not know that this API change was coming and why weren't we prepared for it? Where does Genesys announce upcoming API changes? (so we can monitor) and specifically, where is the announcement that the totalHits change was coming? I haven't been able to find it.
tim.smith | 2021-05-19 20:03:37 UTC | #4
@Paul_Ammirata Please refer to the change management policy: https://developer.genesys.cloud/api/rest/changemanagement. TLDR; the announcements category: https://developer.genesys.cloud/forum/c/announcements/20
system | 2021-06-19 20:03:43 UTC | #5
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 10938