[wp-trac] [WordPress Trac] #49187: WordPress REST API incorrect pagination

WordPress Trac noreply at wordpress.org
Mon Jan 13 14:58:17 UTC 2020


#49187: WordPress REST API incorrect pagination
--------------------------+-----------------------------
 Reporter:  akshayshah    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:  5.3.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 The header `x-wp-total` value is inconsistent with the actual number of
 objects in the payload for some cases
 See screenshot/attachment

 {{{
 ubuntu at wordpress:~$ python3
 Python 3.6.8 (default, Oct  7 2019, 12:59:55)
 [GCC 8.3.0] on linux
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import json, requests
 >>> response = requests.get("http://WORDPRESS_IP/wp-json/wp/v2/media",
 params={"per_page": 100, "page": 1})
 >>> int(response.headers.get("x-wp-total"))
 67
 >>> len(response.json())
 66
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49187>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list