WordPress.org

WordPRess GSoC

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#266 closed enhancement (fixed)

Enable collection pagination

Reported by: rmccue Owned by: rmccue
Milestone: 2013 Midterm (Beta) Priority: major
Component: JSON REST API Keywords:
Cc: prettyboymp

Description

Tracking ticket for week 4.

Change History (9)

#1 @rmccue
4 years ago

  • Type changed from defect to enhancement

#2 @bpetty
3 years ago

  • Milestone set to 2013 Midterm (Beta)

#3 @prettyboymp
3 years ago

  • Cc prettyboymp added

#4 @rmccue
3 years ago

In 2083:

Add better pagination tools

See #266, #267, #268

#5 @rmccue
3 years ago

In 2084:

Allow always passing in posts_per_page

See #266

#6 follow-up: @bpetty
3 years ago

I see posts_per_page, and page, but I'm not currently seeing any value indication in the schema for total number of items in a paged collection. I know some REST APIs will include a "last" link header, leaving it open for some parsing and calculations to get the total number of items. I still would like to see a total count somewhere else not requiring extra URL parsing, but I'm not sure where the best place for this would be honestly.

#7 in reply to: ↑ 6 @rmccue
3 years ago

Replying to bpetty:

I see posts_per_page, and page, but I'm not currently seeing any value indication in the schema for total number of items in a paged collection. I know some REST APIs will include a "last" link header, leaving it open for some parsing and calculations to get the total number of items. I still would like to see a total count somewhere else not requiring extra URL parsing, but I'm not sure where the best place for this would be honestly.

Ah, whoops! This should be in query_navigation_headers() with the next/previous links. Agreed on the "last" header. Most likely, an X-WP-Total header would be the best option for a proper count.

(Just to head off any comments: While X- headers are deprecated for things likely to make it into standards, they're still fine to use for vendor-specific headers.)

#8 @rmccue
3 years ago

  • Resolution set to fixed
  • Status changed from new to closed

In 2291:

Add header for the number of total pages

Fixes #266

#9 @rmccue
3 years ago

In 2293:

Send X-WP-Total with the total number of posts

See #266

Note: See TracTickets for help on using tickets.