Mobile Content Service

The Mobile Content Service provides a variety of APIs for shipping mobile friendly content to app clients. It was built to replace the apps' usage of the MediaWiki action API  module and to incorporate page content transforms that were previously being performed in JavaScript on the client post-page load.

Its successor is the Page Content Service.

Phabricator project: #mobile_content_service, shortcut: #mcs

Endpoints
Production routes start with.

Local dev box routes start with  (for MCS directly) or   (for RB).

.../?doc (Swagger UI)
Stability: stable

You can access the Swagger UI at the /?doc route. Examples: Prod | Beta cluster | Labs | Local RB | Local MCS

.../page/mobile-sections/{title}
Stability: unstable

.../page/mobile-sections-lead/{title}
Stability: unstable

.../page/mobile-sections-remaining/{title}
Stability: unstable

These three routes are used by the beta Android app when the  developer option is enabled (which is now enabled by default).

The output has a similar JSON structure to the PHP  module, except:


 * has a top-level object with two properties:  and  . This is an endpoint which gets the contents of the next two endpoints in one single request, which is useful for refreshing saved pages.
 * Examples: Prod | Beta cluster | Labs | Local RB | Local MCS
 * Is used for the initial page load.
 * Instead of the  object to get the URL for the lead image it has a   property under  . This object contains a hashtable of common lead image widths (640, 800, 1024) pointing to respective URL of the lead image in the size in pixel.
 * If the article has a pronunciation the the  object has a   string with the fully qualified URL to the pronunciation file.
 * If the article uses one of the  templates the the   object has a   array with the fully qualified URLs to the parts of a recorded audio version of this article.
 * If there are Geo coordinates associated with the article then the  object will have the   and   of the place.
 * The  array includes the information needed to display the lead section and also to build the table of contents. Therefore, it has the section text of the lead section only and the rest of the sections don't include it.
 * Examples: Prod | Beta cluster | Labs | Local RB | Local MCS
 * The  array includes the information needed to display the lead section and also to build the table of contents. Therefore, it has the section text of the lead section only and the rest of the sections don't include it.
 * Examples: Prod | Beta cluster | Labs | Local RB | Local MCS


 * Note that this route's  array does not include the lead section text since this was already retrieved as part of the lead response.
 * Examples: Prod | Beta cluster | Labs | Local RB | Local MCS
 * For debugging: The HTML content comes from Parsoid. To make it more convenient to debug transformations at a high level here are the respective examples from Parsoid:
 * Examples: Prod | Beta cluster | Labs | Local RB | Local MCS
 * For comparison, here are the equivalent  requests the Android app uses:
 * Examples: Lead | Remaining
 * Examples: Lead | Remaining

.../page/definition/{title}
Stability: stable

This route provides a set of definitions pulled from the Wiktionary page from the term. (It does not provide the Wiktionary content in full.)

Currently used in the Wikipedia Beta Android app, where users can view a popup with definitions by highlighting a word in the app and choosing the "define" option from the context menu.

Available for English Wiktionary only; rollout to other languages pending based on user engagement.

Note: this endpoint is not for Wikipedia sites, only for Wiktionary.

Examples: Prod | Beta cluster (MCS and Parsoid not setup for some reason) | Labs | Local RB | Local MCS (Wiktionary entry of bar)