Intro/History/Motivation
The web team would like to use something similar to the mobile-sections* endpoints in the future. The current mobile-sections* endpoint implementation is lacking some features and flexibility the web team would like to see in order to adopt the endpoints for their use. We would also like to incorporate learning from the performance related investigations (the loot project). @Jdlrobson has created a set of patches which create a new pair of endpoints to be more suitable for the web teams use.
Proposed changes (see also subtasks)
- Because the loading model changes from a two-step model to a single step with on-demand references we're creating a new set of endpoints:
- /page/formatted/{title} (everything except references)
- /page/references/{title}/{revision?}
- Instead of a two-step load of all content all the time the new endpoints separate the reference sections so they can be loaded on demand
- Intra-wiki links use relative paths (./) instead of /wiki/ we used from the action=mobileview days.
- Expose page issues, hatnotes, and an infobox as separate JSON properties
- Instead of the sections property on the lead response there will be a toc, intro, and a text property. The latter is the remainder of the lead section text (minus the intro). The intro is somewhat akin to the first (reading) paragraph but may contain a few more tags after the first <p>.
Goals of this discussion
- In this task we would like to decide what a mobile-sections endpoint replacements would look like, and how it differs from the existing mobile-sections endpoints.
- Let's see if we can even come up with better names for the first new endpoint, currently called formatted.
- In addition to the web team, I would like to also open this up to Android, iOS app devs, and any other potential users of the API, so we can come up with an API that can be used by many.
Examples
Experimental new API (to be changed)
http://localhost:6927/en.wikipedia.org/v1/page/formatted/Barack_Obama { "lead": { "ns": 0, "id": 534366, "revision": "765720215", "lastmodified": "2017-02-16T01:34:41Z", "lastmodifier": { "name": "Bbb23", "gender": "male" }, "displaytitle": "Barack Obama", "normalizedtitle": "Barack Obama", "wikibase_item": "Q76", "description": "44th President of the United States of America", "protection": { "edit": [ "autoconfirmed" ], "move": [ "sysop" ] }, "editable": false, "languagecount": 219, "image": { "file": "President Barack Obama.jpg", "urls": { "320": "//upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/320px-President_Barack_Obama.jpg", "640": "//upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/640px-President_Barack_Obama.jpg", "800": "//upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/800px-President_Barack_Obama.jpg", "1024": "//upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/1024px-President_Barack_Obama.jpg" } }, "pronunciation": { "url": "//upload.wikimedia.org/wikipedia/commons/8/82/En-us-Barack-Hussein-Obama.ogg" }, "spoken": { "files": [ "File:Barack Obama.ogg" ] }, "hatnotes": [ "\"Barack\" and \"Obama\" redirect here. For other uses, see <a href=\"/wiki/Barack_(disambiguation)\" title=\"Barack (disambiguation)\">Barack (disambiguation)</a> and <a href=\"/wiki/Obama_(disambiguation)\" title=\"Obama (disambiguation)\">Obama (disambiguation)</a>." ], "infobox": "...(blob of HTML)...", "intro": "...(blob of HTML)...", "text": "...(very large blob of HTML)..." }, "remaining": { "sections": [ { "id": 1, "text": "...(very large blob of HTML)...", "toclevel": 1, "line": "Early life and career", "anchor": "Early_life_and_career" }, ...(~50 more)..., { "id": 55, "text": "...(very large blob of HTML)...", "toclevel": 2, "line": "Other", "anchor": "Other" } ] } }
Old API
https://en.wikipedia.org/api/rest_v1/page/mobile-sections-lead/Barack_Obama { "ns": 0, "id": 534366, "revision": "765720215", "lastmodified": "2017-02-16T01:34:41Z", "lastmodifier": { "name": "Bbb23", "gender": "male" }, "displaytitle": "Barack Obama", "normalizedtitle": "Barack Obama", "wikibase_item": "Q76", "description": "44th President of the United States of America", "protection": { "edit": [ "autoconfirmed" ], "move": [ "sysop" ] }, "editable": false, "languagecount": 219, "image": { "file": "President Barack Obama.jpg", "urls": { "320": "//upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/320px-President_Barack_Obama.jpg", "640": "//upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/640px-President_Barack_Obama.jpg", "800": "//upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/800px-President_Barack_Obama.jpg", "1024": "//upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/1024px-President_Barack_Obama.jpg" } }, "pronunciation": { "url": "//upload.wikimedia.org/wikipedia/commons/8/82/En-us-Barack-Hussein-Obama.ogg" }, "spoken": { "files": [ "File:Barack Obama.ogg" ] }, "hatnotes": [ "\"Barack\" and \"Obama\" redirect here. For other uses, see <a href=\"/wiki/Barack_(disambiguation)\" title=\"Barack (disambiguation)\">Barack (disambiguation)</a> and <a href=\"/wiki/Obama_(disambiguation)\" title=\"Obama (disambiguation)\">Obama (disambiguation)</a>." ], "sections": [ { "id": 0, "text": "...(very large blob of HTML)..." }, { "id": 1, "toclevel": 1, "anchor": "Early_life_and_career", "line": "Early life and career" }, ...(~50 more)..., { "id": 55, "toclevel": 2, "anchor": "Other", "line": "Other" } ] }
https://en.wikipedia.org/api/rest_v1/page/mobile-sections-remaining/Barack_Obama { "sections": [ { "id": 1, "text": "...(very large blob of HTML)...", "toclevel": 1, "line": "Early life and career", "anchor": "Early_life_and_career" }, ...(~50 more)..., { "id": 55, "text": "...(very large blob of HTML)...", "toclevel": 2, "line": "Other", "anchor": "Other" } ] }
https://en.wikipedia.org/api/rest_v1/page/mobile-sections/Barack_Obama { "lead": { "ns": 0, "id": 534366, "revision": "765720215", "lastmodified": "2017-02-16T01:34:41Z", "lastmodifier": { "name": "Bbb23", "gender": "male" }, "displaytitle": "Barack Obama", "normalizedtitle": "Barack Obama", "wikibase_item": "Q76", "description": "44th President of the United States of America", "protection": { "edit": [ "autoconfirmed" ], "move": [ "sysop" ] }, "editable": false, "languagecount": 219, "image": { "file": "President Barack Obama.jpg", "urls": { "320": "//upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/320px-President_Barack_Obama.jpg", "640": "//upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/640px-President_Barack_Obama.jpg", "800": "//upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/800px-President_Barack_Obama.jpg", "1024": "//upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/1024px-President_Barack_Obama.jpg" } }, "pronunciation": { "url": "//upload.wikimedia.org/wikipedia/commons/8/82/En-us-Barack-Hussein-Obama.ogg" }, "spoken": { "files": [ "File:Barack Obama.ogg" ] }, "hatnotes": [ "\"Barack\" and \"Obama\" redirect here. For other uses, see <a href=\"/wiki/Barack_(disambiguation)\" title=\"Barack (disambiguation)\">Barack (disambiguation)</a> and <a href=\"/wiki/Obama_(disambiguation)\" title=\"Obama (disambiguation)\">Obama (disambiguation)</a>." ], "sections": [ { "id": 0, "text": "...(very large blob of HTML)..." }, { "id": 1, "toclevel": 1, "anchor": "Early_life_and_career", "line": "Early life and career" }, ...(~50 more)..., { "id": 55, "toclevel": 2, "anchor": "Other", "line": "Other" } ] }, "remaining": { "sections": [ { "id": 1, "text": "...(very large blob of HTML)..." }, { "id": 2, "text": "...(very large blob of HTML)...", "toclevel": 2, "line": "Education", "anchor": "Education" }, ...(~50 more)..., { "id": 55, "text": "...(very large blob of HTML)...", "toclevel": 2, "line": "Other", "anchor": "Other" } ] } }
Notes
- mobile-sections-lead / remaining are used for all Android pageviews
- Only the Android background page downloader service uses mobile-sections; newer versions of the app will no longer use this endpoint as part of T156917 or a related task
- Android remote RESTBase / MediaWiki config options