prop=info API query should surface number of edits
Open, NormalPublic

Description

Using https://en.m.wikipedia.org/wiki/San%20Francisco?action=info I can access the number of edits a page has.
When I try the same query in the API this information is not available.
https://en.wikipedia.org/wiki/Special:ApiSandbox#action=query&format=json&prop=info&titles=San+Francisco&formatversion=2

Why not?

It seems I'm not alone in wanting this...
http://stackoverflow.com/questions/22158779/how-to-get-total-number-of-edits-for-a-given-wikipedia-page-from-the-api

This would be useful for a MobileFrontend browser test which needs to assure that a page has a certain amount of edits
features/special_history.feature

Jdlrobson created this task.Oct 7 2016, 8:45 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 7 2016, 8:45 PM
Anomie added a subscriber: Anomie.Oct 11 2016, 4:02 PM

The tricky part might be efficiently querying the number of edits for up to 5000 pages. Is SELECT rev_page, COUNT(*) FROM revision WHERE rev_page IN (/* 5000 integers */) GROUP BY rev_page efficient enough?

Typically an API client that needs this information would just hit prop=revisions&rvprop=&rvlimit={$X+1} (where $X is the most it cares about) and see how many revisions get returned.

Wait we query the database for this? Can we not store this as a page property and update it on save/move/edit?

Such a thing could be done, if someone wanted to do it.

The implementation in InfoAction makes the DB query (plus several more queries) for the one page and caches it; the API implementation could potentially reuse this cache when it exists, if hitting 5000 cache keys isn't a problem; populating the cache would require making all the queries that InfoAction does, which again would potentially be a lot of work.

Even if a lot of work it seems like it would be a valuable thing to do.

ovasileva triaged this task as Normal priority.Oct 12 2016, 3:29 PM
ovasileva moved this task from To Triage to Triaged but Future on the Readers-Web-Backlog board.
Legoktm renamed this task from action=info API query should surface number of edits to prop=info API query should surface number of edits.Jan 30 2017, 4:11 AM

@Jdlrobson: Hmm, I don't see this task listed under https://www.mediawiki.org/wiki/Developer_Wishlist/2017 - could explain why you added Developer-Wishlist?

It was my understanding Developer-Wishlist was a project developers could add items to over the course of the year for nomination for the following year (in this case 2018) rather than during a specific week where they may not remember what's causing them pain and Developer-Wishlist (2017) was the project capturing the results for 2017.

It was my understanding Developer-Wishlist was a project developers could add items to over the course of the year for nomination for the following year (in this case 2018) rather than during a specific week where they may not remember what's causing them pain and Developer-Wishlist (2017) was the project capturing the results for 2017.

Jdforrester-WMF added a subscriber: Jdforrester-WMF.

I've created a sub-project for proposals for the next run of the developer wishlist and moved this there.

Jdlrobson moved this task from Backlog to Watching on the Readers-Web-Backlog (Tracking) board.
Jdlrobson moved this task from Watching to Blocked on the Readers-Web-Backlog (Tracking) board.