分页问题 [英] Issue in pagination

查看:58
本文介绍了分页问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用API​​获取响应,我的记录总数为139.但是我一次只能收到50条记录API拥有的最大限制。作为回复,我只收到记录的总数和数据,但是
没有上一页或下一页的链接。所以我试图为分页添加动态内容,但我不知道如何循环偏移值和 发送回复  (记录总数/限制)次数。我也在下面提供了我的请求。
请帮忙。



端点: https://apps.net-results.com/api/v2/rpc/server.php?Controller=Visit



请求类型:POST


Http请求:


{

" id":" 123abc",
" method" ;:\"getAllMultiple&\",,
" jsonrpc":" 2.0",

" params":{

" offset":0,

" limit":50,

" ORDER_BY& quot;:" last_access",$
" order_dir":" DESC",
" contact_segment_id" ;:385604,

" start_date" ;:1516751332,

" stop_date":1548200932

$
}

}

解决方案


Hi Sunakshi,



你能否分享你的相对网址的结构?如果它的形式如下:



https://reqres.in/api/users?page=1



https://reqres.in/api/users?page=2



https://reqres.in/api/users?page=3



依此类推,其中(1,2,3 ...)作为响应中的属性
(Say,nextUrl),你可以试试这个:




  • 将链接服务中的baseUrl设置为https://reqres.in/api/users?page=1,并将dataseU中的relativeUrl保留为空。
  • < li style ="border:none;字体重量:继承;字体风格:继承; FONT-FAMILY:继承;保证金:0像素;概要:0像素;填充:0像素; list-style-type:disc">
    将paginationRules更改为"QueryParameters.page":"


.nextUrl


如果它的形式使得next的整个网址不同,您可以将链接服务中的baseUrl设为https://reqres.in/api/users ?page = 1,并将dataseU中的relativeUrl保留为空。 并且在paginationRules中,有"AbsoluteUrl":"


.nextUrl"


< ul style ="border:none; font-family:'Segoe UI','Lucida Grande',Verdana,Arial,Helvetica,sans-serif;保证金:0px 0px 0px 3em;概要:0像素;填充:0像素;行高:17.5px;列表样式类型:无;颜色:#333333; font-size:14px">



  • Hi,

    I am consuming an API where I get the response and my total number of records are 139. But at a time I can only receive 50 records as per the max limit that the API holds. And as a response I only receive total number of records along with the data but there is no link for a previous or next page. So I am trying to add a dynamic content to the pagination, but I am not sure how can I loop the offset value and  send the response  (total number of records/limit) times. I have also provided my request below. Kindly help.

    endpoint:https://apps.net-results.com/api/v2/rpc/server.php?Controller=Visit

    request type: POST

    Http request:

    {
    "id": "123abc",
    "method": "getAllMultiple",
    "jsonrpc": "2.0",
    "params": {
    "offset": 0,
    "limit": 50,
    "order_by": "last_access",
    "order_dir": "DESC",
    "contact_segment_id": 385604,
    "start_date": 1516751332,
    "stop_date": 1548200932

    }
    }

    解决方案

    Hi Sunakshi,

    Can you please share the Structure of your relative URL ? If it's in the form :

    https://reqres.in/api/users?page=1

    https://reqres.in/api/users?page=2

    https://reqres.in/api/users?page=3

    and so on, where (1,2,3...) come as an attribute in the response (Say, nextUrl), you can try this :

    • Make the baseUrl in the linked service as https://reqres.in/api/users?page=1, and leave relativeUrl in dataset as empty.
    • change the paginationRules as "QueryParameters.page": "


    .nextUrl

    If it's in a form where the whole URL for next is different, you can make the baseUrl in linked service as https://reqres.in/api/users?page=1, and leave relativeUrl in dataset as empty.  and in paginationRules, have "AbsoluteUrl": "


    .nextUrl"


    这篇关于分页问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆