Forum Discussion

bhupen's avatar
bhupen
Advisor
10 years ago

Error on notification when increasing 1000+

Hi

Iam facing some issue in restapi. When user have more then 1000 notification then its showing error. If notification are less then 999 then its working fine.
<#assign notificationCounter = 1 />
    <#assign pageSize            = 50 />
    <#assign page = notificationsPage * pageSize />
    <#assign noti= restadmin( '/users/id/' + user.id + '/notifications?restapi.response_style=view&page_size=' + page ).notifications />
    
    Following is the error which is coming on used rest api.
    
    /notification?restapi.response_style=view&page_size=1100&restapi.response_style=view"
   Page_size:this must be less then or equal to 1,000.error.PNG

 

Can someone suggest me on this..

 

Thanks

  • Maximum results in a REST API for page_size is 1000, you have to paginate using page parameter.
    • bhupen's avatar
      bhupen
      Advisor

      VarunGrazitti  thanks for reply. Is there any example for pagination. so that I can make this code working

  • Hi,

    I have done pagination something like this but still its not working any one there to help me out.

    <#assign notificationsPage   = 1 />

    <#assign pageSize            = 50 />

    <#list 1..3 as y>
              <#assign page = notificationsPage * pageSize />
              <#assign nots = restadmin( '/users/id/' + user.id + '/notifications?restapi.response_style=view&page_size=' + page + '&page=' + y).notifications />

    </#list>