# MobileApps page-manipulation service tags: - name: Mobile description: mobile-friendly page content paths: /mobile-sections/{title}{/revision}: x-route-filters: - path: ./lib/revision_table_access_check_filter.js options: redirect_cache_control: '{{options.response_cache_control}}' - path: lib/ensure_content_type.js get: tags: - Mobile summary: Get mobile-optimized HTML sections for a title. description: | Retrieve the latest HTML for a page title optimised for viewing with native mobile applications. Note that the output is split by sections. Stability: [unstable](https://www.mediawiki.org/wiki/API_versioning#Unstable) produces: - application/json; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/mobile-sections/0.13.2" parameters: - name: title in: path description: "Page title. Use underscores instead of spaces. Example: `Main_Page`." type: string required: true - name: revision in: path description: > Optional page revision. Note that older revisions are not stored, so request latency with the revision would be higher. required: false - name: redirect in: query description: > Requests for [redirect pages](https://www.mediawiki.org/wiki/Help:Redirects) return HTTP 302 with a redirect target in `Location` header and content in the body. To get a 200 response instead, supply `false` to the `redirect` parameter. type: boolean required: false responses: '200': description: JSON containing HTML sections and metadata for the given page title. schema: type: object # FIXME! headers: ETag: description: > Syntax: "{revision}/{tid}". Example: "701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc" '301': description: | A permanent redirect is returned if the supplied article title was not in the normalized form. To avoid this kind of redirect, you can use the [mediawiki-title](https://github.com/wikimedia/mediawiki-title) library to perform title normalization client-side. Beware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`) will fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204). '302': description: | The page is a [redirect page](https://www.mediawiki.org/wiki/Help:Redirects). The `location` header points to the redirect target. If you would like to avoid automatically following redirect pages, set the `redirect=false` query parameter. Beware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`) will fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204). '404': description: Unknown page title schema: $ref: '#/definitions/problem' default: description: Error schema: $ref: '#/definitions/problem' x-request-handler: - from_backend: request: method: get uri: /{domain}/sys/mobileapps/mobile-sections/{title}{/revision} headers: cache-control: '{{cache-control}}' return: status: '{{from_backend.status}}' headers: '{{ merge({"cache-control": options.response_cache_control}, from_backend.headers) }}' body: '{{from_backend.body}}' x-monitor: true x-amples: - title: Get mobile-sections for a test page on enwiki request: params: domain: en.wikipedia.org title: User:BSitzmann_(WMF)/MCS/Test/Frankenstein response: status: 200 headers: content-type: /application\/json/ body: lead: /.+/ remaining: /.+/ /mobile-sections-lead/{title}{/revision}: x-route-filters: - path: ./lib/revision_table_access_check_filter.js options: redirect_cache_control: '{{options.response_cache_control}}' - path: lib/ensure_content_type.js get: tags: - Mobile summary: Get mobile-optimized HTML lead section and metadata for a title. description: | Retrieve the lead section of the latest HTML for a page title optimised for viewing with native mobile applications. Stability: [unstable](https://www.mediawiki.org/wiki/API_versioning#Unstable) produces: - application/json; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/mobile-sections/0.13.2" parameters: - name: title in: path description: "Page title. Use underscores instead of spaces. Example: `Main_Page`." type: string required: true - name: revision in: path description: > Optional page revision. Note that older revisions are not stored, so request latency with the revision would be higher. required: false - name: redirect in: query description: > Requests for [redirect pages](https://www.mediawiki.org/wiki/Help:Redirects) return HTTP 302 with a redirect target in `Location` header and content in the body. To get a 200 response instead, supply `false` to the `redirect` parameter. type: boolean required: false responses: '200': description: The HTML for the given page title. schema: type: object # FIXME! headers: ETag: description: > Syntax: "{revision}/{tid}". Example: "701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc" '301': description: | A permanent redirect is returned if the supplied article title was not in the normalized form. To avoid this kind of redirect, you can use the [mediawiki-title](https://github.com/wikimedia/mediawiki-title) library to perform title normalization client-side. Beware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`) will fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204). '302': description: | The page is a [redirect page](https://www.mediawiki.org/wiki/Help:Redirects). The `location` header points to the redirect target. If you would like to avoid automatically following redirect pages, set the `redirect=false` query parameter. Beware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`) will fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204). '404': description: Unknown page title schema: $ref: '#/definitions/problem' default: description: Error schema: $ref: '#/definitions/problem' x-request-handler: - from_backend: request: method: get uri: /{domain}/sys/mobileapps/mobile-sections-lead/{title}{/revision} headers: cache-control: '{{cache-control}}' return: status: '{{from_backend.status}}' headers: '{{ merge({"cache-control": options.response_cache_control}, from_backend.headers) }}' body: '{{from_backend.body}}' x-monitor: false /mobile-sections-remaining/{title}{/revision}: x-route-filters: - path: ./lib/revision_table_access_check_filter.js options: redirect_cache_control: '{{options.response_cache_control}}' - path: lib/ensure_content_type.js get: tags: - Mobile summary: Get non-lead mobile-optimized HTML sections for a title. description: | Retrieve the remainder of the latest HTML (without the lead section) for a page title optimised for viewing with native mobile applications, provided as a JSON object containing the sections. Stability: [unstable](https://www.mediawiki.org/wiki/API_versioning#Unstable) produces: - application/json; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/mobile-sections/0.13.2" parameters: - name: title in: path description: "Page title. Use underscores instead of spaces. Example: `Main_Page`." type: string required: true - name: revision in: path description: > Optional page revision. Note that older revisions are not stored, so request latency with the revision would be higher. required: false - name: redirect in: query description: > Requests for [redirect pages](https://www.mediawiki.org/wiki/Help:Redirects) return HTTP 302 with a redirect target in `Location` header and content in the body. To get a 200 response instead, supply `false` to the `redirect` parameter. type: boolean required: false responses: '200': description: JSON wrapping HTML sections for the given page title. schema: type: object # FIXME! headers: ETag: description: > Syntax: "{revision}/{tid}". Example: "701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc" '301': description: | A permanent redirect is returned if the supplied article title was not in the normalized form. To avoid this kind of redirect, you can use the [mediawiki-title](https://github.com/wikimedia/mediawiki-title) library to perform title normalization client-side. Beware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`) will fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204). '302': description: | The page is a [redirect page](https://www.mediawiki.org/wiki/Help:Redirects). The `location` header points to the redirect target. If you would like to avoid automatically following redirect pages, set the `redirect=false` query parameter. Beware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`) will fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204). '404': description: Unknown page title schema: $ref: '#/definitions/problem' default: description: Error schema: $ref: '#/definitions/problem' x-request-handler: - from_backend: request: method: get uri: /{domain}/sys/mobileapps/mobile-sections-remaining/{title}{/revision} headers: cache-control: '{{cache-control}}' return: status: '{{from_backend.status}}' headers: '{{ merge({"cache-control": options.response_cache_control}, from_backend.headers) }}' body: '{{from_backend.body}}' x-monitor: false