【问题标题】:Json records not showing all data. How to work with the "per_page" attribute?Json 记录未显示所有数据。如何使用“per_page”属性?
【发布时间】:2021-12-27 10:34:30
【问题描述】:

我正在使用 softqare Red Hat Satellite 来更新我的 Linux 服务器。为此,我还需要使用 curl 获取所有可用的更新,如下所示:

curl --request GET --insecure --silent --user username:password https://myMachine/katello/api/errata

这是命令返回的内容

{"total":536,"subtotal":536,"page":1,"per_page":20,"error":null,"search":null,"sort":{"by":"updated","order":"desc"},"results":[{errata1},{errata2},...{errata20}}

如您所见,我提供的勘误表总数为 536,但它只返回 20 个勘误表。这是因为 per_page 属性。 有没有办法让 curl 显示 536 结果,或者是否可以执行 PUT 请求以更改 per_page 数据? 解决这个问题的最佳方法是什么?

【问题讨论】:

    标签: json api curl


    【解决方案1】:

    我找到了一种方法,可以使用以下命令更改每页显示多少数据:

    curl --request GET --insecure --silent --user username:password https://myMachine/katello/api/errata?per_page=100 
    

    我也可以用以下 curl 指定页面:

    curl --request GET --insecure --silent --user username:password https://myMachine/katello/api/errata?page=1&per_page=100
    

    【讨论】:

      猜你喜欢
      • 2018-07-24
      • 2015-03-01
      • 1970-01-01
      • 2015-08-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多