Topic on API talk:Compare/Flow

Relative comparison at first and last revision

1
EvanProdromou (talkcontribs)

You can ask for a relative comparison to prev at the first revision of a page:


https://en.wikipedia.org/w/api.php?action=compare&fromrev=14189795&torelative=prev


This will result in the full text of the first revision being returned as the diff. Note that this is not accurate, since in some cases there may be default content for the page before its first revision. The fromrevid property will be absent from the results.


Similarly, you can ask for the next relative comparison on the last revision of a page:

https://en.wikipedia.org/w/api.php?action=compare&fromrev=874792395&torelative=next


(Note: this is the last revision as of the writing of this topic. Because the page is protected, it probably should not change.) The result is an empty diff, and the torevid will be absent. Unlike most revision comparisons, these results will change if a new revision is created.

This behaviour in the API is historical. It isn't consistent with the conceptual model of page history as a series of revisions. There is no "previous" revision to compare against the first revision, nor is there a "next" revision to compare against the last. Because of this, future versions of MediaWiki may give different results for this API call.

Reply to "Relative comparison at first and last revision"