Difference between revisions of "MySwaggerJsonSpec"
Jump to navigation
Jump to search
m Tag: Manual revert |
|||
(9 intermediate revisions by the same user not shown) | |||
Line 15: | Line 15: | ||
} | } | ||
}, | }, | ||
"basePath": "/ | "basePath": "/rest.php/v1", | ||
"tags": [ | "tags": [ | ||
{ | { |
Latest revision as of 14:23, 13 September 2022
{
"swagger": "2.0", "info": { "description": "This API provides cacheable and straightforward access to Wikimedia content and data, in machine-readable formats.\n### Global Rules\n- Limit your clients to no more than 200 requests/s to this API.\n Each API endpoint's documentation may detail more specific usage limits.\n- Set a unique `User-Agent` or `Api-User-Agent` header that\n allows us to contact you quickly. Email addresses or URLs\n of contact pages work well.\n\nBy using this API, you agree to Wikimedia's [Terms of Use](https://wikimediafoundation.org/wiki/Terms_of_Use) and [Privacy Policy](https://wikimediafoundation.org/wiki/Privacy_policy). Unless otherwise specified in the endpoint documentation below, content accessed via this API is licensed under the [CC-BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/) and [GFDL](https://www.gnu.org/copyleft/fdl.html) licenses, and you irrevocably agree to release modifications or additions made through this API under these licenses. See https://www.mediawiki.org/wiki/REST_API for background and details.\n### Endpoint documentation\nPlease consult each endpoint's documentation for details on:\n- Licensing information for the specific type of content\n and data served via the endpoint.\n- Stability markers to inform you about development status and\n change policy, according to\n [our API version policy](https://www.mediawiki.org/wiki/API_versioning).\n- Endpoint specific usage limits.\n", "version": "1.0.0", "title": "Wikimedia REST API", "termsOfService": "https://wikimediafoundation.org/wiki/Terms_of_Use", "contact": { "name": "the Wikimedia Services team", "url": "http://mediawiki.org/wiki/REST_API" }, "license": { "name": "Apache2", "url": "http://www.apache.org/licenses/LICENSE-2.0" } }, "basePath": "/rest.php/v1", "tags": [ { "name": "Page content", "description": "page content in different formats" }, { "name": "Page content", "description": "page content in different formats" }, { "name": "Mobile", "description": "mobile-friendly page content" }, { "name": "Feed", "description": "aggregated daily featured content" }, { "name": "Transforms", "description": "convert content between HTML and Wikitext" }, { "name": "Math", "description": "formula rendering" }, { "name": "Citation", "description": "generation of citation data" }, { "name": "Reading lists", "description": "Private lists of selected pages", "externalDocs": { "description": "Project documentation", "url": "https://www.mediawiki.org/wiki/Reading/Reading_Lists" } }, { "name": "Recommendation", "description": "article translation recommendations" } ], "paths": { "/page/": { "get": { "tags": [ "Page content" ], "summary": "List page-related API entry points.", "description": "Stability: [stable](https://www.mediawiki.org/wiki/API_versioning#Stable)\n", "produces": [ "application/json", "application/problem+json" ], "parameters": [], "responses": { "200": { "description": "A list of page-related API end points.", "schema": { "$ref": "#/definitions/listing" } }, "default": { "description": "Error", "schema": { "$ref": "#/definitions/problem" } } }, "x-monitor": false } }, "/page/title/{title}{/revision}": { "get": { "tags": [ "Page content" ], "summary": "Get revision metadata for a title.", "description": "Returns the revision metadata for the given title. If a revision ID is provided,\nmetadata for that revision is returned, otherwise the latest revision ID is assumed.\n\nStability: [stable](https://www.mediawiki.org/wiki/API_versioning#Stable).\n", "produces": [ "application/json", "application/problem+json" ], "parameters": [ { "name": "title", "in": "path", "description": "Page title. Use underscores instead of spaces. Example: `Main_Page`.", "required": true, "type": "string" }, { "name": "revision", "in": "path", "description": "The revision id", "required": false, "type": "integer" } ], "responses": { "200": { "description": "The latest revision metadata for the provided title.", "schema": { "$ref": "#/definitions/revision" } }, "301": { "description": "A permanent redirect is returned if the supplied article title was not in the normalized form.\nTo avoid these redirects, you can use the [mediawiki-title](https://github.com/wikimedia/mediawiki-title) library to perform\ntitle normalization client side.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "302": { "description": "The page is a [redirect page](https://www.mediawiki.org/wiki/Help:Redirects).\nThe `location` header points to the redirect target.\nIf you would like to avoid automatically following redirect pages, set the `redirect=false` query parameter.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "404": { "description": "Unknown page title or no revisions found.", "schema": { "$ref": "#/definitions/problem" } }, "default": { "description": "Error", "schema": { "$ref": "#/definitions/problem" } } }, "x-monitor": true, "x-amples": [ { "title": "Get rev by title from storage", "request": { "params": { "domain": "en.wikipedia.org", "title": "User:BSitzmann_(WMF)/MCS/Test/Frankenstein" } }, "response": { "status": 200, "headers": { "etag": "/.+/", "content-type": "application/json" }, "body": { "items": [ { "title": "User:BSitzmann_(WMF)/MCS/Test/Frankenstein", "rev": "/\\d+/", "tid": "/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/", "comment": "/.*/", "page_language": "en" } ] } } } ] } }, "/page/html/{title}": { "get": { "tags": [ "Page content" ], "summary": "Get latest HTML for a title.", "description": "Stability: [stable](https://www.mediawiki.org/wiki/API_versioning#Stable)\n", "produces": [ "text/html; charset=utf-8; profile=\"https://www.mediawiki.org/wiki/Specs/HTML/1.7.0\"", "application/json", "application/problem+json" ], "parameters": [ { "name": "title", "in": "path", "description": "Page title. Use underscores instead of spaces. Example: `Main_Page`.", "required": true, "type": "string" }, { "name": "sections", "in": "query", "description": "Comma-separated list of section IDs.", "required": false, "type": "string" }, { "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.\nTo get a 200 response instead, supply `false` to the `redirect` parameter.\n", "required": false, "type": "boolean" }, { "name": "Accept-Language", "in": "header", "description": "The desired language variant code for wikis where LanguageConverter is enabled. Example: `sr-el` for Latin transcription of the Serbian language.\n", "required": false, "type": "string" } ], "responses": { "200": { "description": "The latest HTML for the given page title.\n\nSee [the MediaWiki DOM\nspec](https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec) for a\ndescription of the MediaWiki-specific semantic markup in this HTML.\nNote that additional metadata is available in the HTML head.\n", "headers": { "ETag": { "type": "string", "description": "ETag header indicating the revision and render timeuuid\nseparated by a slash:\n\"701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc\"\nThis ETag can be passed to the HTML save end point (as\n`base_etag` POST parameter), and can also be used to retrieve\nthe exact corresponding data-parsoid metadata, by requesting\nthe specific `revision` and `tid` indicated by the `ETag`.\n" } }, "schema": { "type": "string" } }, "301": { "description": "A permanent redirect is returned if the supplied article title was not in the normalized form.\nTo avoid this kind of redirect, you can use the [mediawiki-title](https://github.com/wikimedia/mediawiki-title) library to perform\ntitle normalization client-side.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "302": { "description": "The page is a [redirect page](https://www.mediawiki.org/wiki/Help:Redirects).\nThe `location` header points to the redirect target, and the body contains the actual page contents as HTML.\nIf you would like to avoid automatically following redirect pages, set the `redirect=false` query parameter.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "404": { "description": "Unknown page title", "schema": { "$ref": "#/definitions/problem" } }, "default": { "description": "Error", "schema": { "$ref": "#/definitions/problem" } } }, "x-monitor": true, "x-amples": [ { "title": "Get html by title from storage", "request": { "params": { "domain": "en.wikipedia.org", "title": "User:BSitzmann_(WMF)/MCS/Test/Frankenstein" } }, "response": { "status": 200, "headers": { "etag": "/.+/", "content-type": "/^text\\/html.+/" }, "body": "/^<!DOCTYPE html>.*/" } } ] }, "post": { "tags": [ "Page content" ], "summary": "Save a new revision using HTML.", "description": "Save a new revision of a page given in [Parsoid\nHTML](https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec)\nformat.\n\nFor new pages, or when editting the latest revision of a page,\nthe `base_etag` parameter should be left empty. For editing old revisions,\nit should contain the `ETag` header of the revision the edit is derived from.\n\nThe latest page revision ETag header could be provided in the If-Match header\nto detect edit conflicts. If the new page is created, appropriate user cookies\nmust be provided.\n\nStability: [unstable](https://www.mediawiki.org/wiki/API_versioning#Unstable)\n", "consumes": [ "multipart/form-data" ], "produces": [ "application/json", "application/problem+json" ], "parameters": [ { "name": "title", "in": "path", "description": "Page title. Use underscores instead of spaces. Example: `Main_Page`.", "required": true, "type": "string" }, { "name": "base_etag", "in": "formData", "description": "ETag header of the revision the edit is based on. Should be supplied for all existing pages to ensure clean round-tripping.\n", "required": false, "type": "string" }, { "name": "html", "in": "formData", "description": "HTML of the page to save.", "required": true, "type": "string", "x-textarea": true }, { "name": "csrf_token", "in": "formData", "description": "CSRF edit token provided by the MW API.", "required": true, "type": "string" }, { "name": "comment", "in": "formData", "description": "Comment summarizing the change.", "required": false, "type": "string" }, { "name": "is_minor", "in": "formData", "description": "Flag indicating a minor change.", "required": false, "type": "boolean" }, { "name": "is_bot", "in": "formData", "description": "Flag indicating a bot edit.", "required": false, "type": "boolean" } ], "responses": { "200": { "description": "The content was not changed, and no new version was created.", "schema": { "type": "object" } }, "201": { "description": "A new revision of the page has been created", "headers": { "ETag": { "type": "string", "description": "ETag header indicating the new revision and timeuuid,\nseparated by a slash:\n\"701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc\"\n" } } }, "400": { "description": "Invalid request - lack of required parameters, bad ETags etc.", "schema": { "$ref": "#/definitions/problem" } }, "409": { "description": "Edit conflict", "schema": { "$ref": "#/definitions/problem" } }, "default": { "description": "Error", "schema": { "$ref": "#/definitions/problem" } } }, "x-monitor": false } }, "/page/html/{title}/": { "get": { "tags": [ "Page content" ], "summary": "List HTML revisions for a title.", "description": "This currently only lists revisions that are already stored in RESTBase.\n\nStability: [experimental](https://www.mediawiki.org/wiki/API_versioning#Experimental)\n", "produces": [ "application/json", "application/problem+json" ], "parameters": [ { "name": "title", "in": "path", "description": "Page title. Use underscores instead of spaces. Example: `Main_Page`.", "required": true, "type": "string" }, { "name": "page", "in": "query", "description": "The next page token, provided by _links.next.href property.", "required": false, "type": "string" } ], "responses": { "200": { "description": "A list of revisions for the given title.", "schema": { "$ref": "#/definitions/revisions" } }, "default": { "description": "Error", "schema": { "$ref": "#/definitions/problem" } } }, "x-monitor": false } }, "/page/html/{title}/{revision}{/tid}": { "get": { "tags": [ "Page content" ], "summary": "Get HTML for a specific title/revision & optionally timeuuid.", "description": "Stability: [stable](https://www.mediawiki.org/wiki/API_versioning#Stable)\n", "operationId": "getFormatRevision", "produces": [ "text/html; charset=utf-8; profile=\"https://www.mediawiki.org/wiki/Specs/HTML/1.7.0\"", "application/json", "application/problem+json" ], "parameters": [ { "name": "title", "in": "path", "description": "Page title. Use underscores instead of spaces. Example: `Main_Page`.", "required": true, "type": "string" }, { "name": "revision", "in": "path", "description": "The revision", "required": true, "type": "integer" }, { "name": "tid", "in": "path", "description": "The revision's time ID", "required": true, "type": "string" }, { "name": "sections", "in": "query", "description": "Comma-separated list of section IDs", "required": false, "type": "string" }, { "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.\nTo get a 200 response instead, supply `false` to the `redirect` parameter.\n", "required": false, "type": "boolean" }, { "name": "Accept-Language", "in": "header", "description": "The desired language variant code for wikis where LanguageConverter is enabled. Example: `sr-el` for Latin transcription of the Serbian language.\n", "required": false, "type": "string" } ], "responses": { "200": { "description": "The html for the given page, revision and tid.\n\nSee [the MediaWiki DOM\nspec](https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec) for a\ndescription of the MediaWiki-specific semantic markup in this HTML.\nNote that additional metadata is available in the HTML head.\n\nThis HTML can be edited using arbitrary HTML tools. The modified HTML\ncan be converted back to wikitext using the\n[/transform/html/to/wikitext{/title}{/revision}](#!/Transforms/transform_html_to_wikitext__title___revision__post)\nentry point.\n", "headers": { "ETag": { "type": "string", "description": "ETag header indicating the revision and render timeuuid\nseparated by a slash:\n\"701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc\"\nThis ETag can be passed to the HTML save end point (as\n`base_etag` POST parameter), and can also be used to retrieve\nthe exact corresponding data-parsoid metadata, by requesting\nthe specific `revision` and `tid` indicated by the `ETag`.\n" } }, "schema": {} }, "301": { "description": "A permanent redirect is returned if the supplied article title was not in the normalized form.\nTo avoid this kind of redirect, you can use the [mediawiki-title](https://github.com/wikimedia/mediawiki-title) library to perform\ntitle normalization client-side.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "302": { "description": "The page is a [redirect page](https://www.mediawiki.org/wiki/Help:Redirects).\nThe `location` header points to the redirect target, and the body contains the actual page revision contents as HTML.\nIf you would like to avoid automatically following redirect pages, set the `redirect=false` query parameter.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "400": { "description": "Invalid revision or tid", "schema": { "$ref": "#/definitions/problem" } }, "403": { "description": "Access to the specific revision is restricted", "schema": { "$ref": "#/definitions/problem" } }, "404": { "description": "Unknown page, revision or tid", "schema": { "$ref": "#/definitions/problem" } }, "default": { "description": "Error", "schema": { "$ref": "#/definitions/problem" } } }, "x-monitor": false } }, "/page/data-parsoid/{title}/{revision}/{tid}": { "get": { "tags": [ "Page content" ], "summary": "Get data-parsoid metadata for a specific title/revision/tid.", "description": "Data-parsoid is metadata used by\n[Parsoid](https://www.mediawiki.org/wiki/Parsoid) to support clean\nround-tripping conversions between HTML and Wikitext. Among other\nthings, it contains the original Wikitext offsets of each HTML\nelement, keyed by element ID. The format is unstable.\n\nThe metadata in data-parsoid is specific to a specific HTML render.\nFor this reason, you need to supply the exact `revision` and `tid` as\nprovided in the `ETag` header of the HTML response.\n\nStability: [Stable](https://www.mediawiki.org/wiki/API_versioning#Stable)\n", "produces": [ "application/json; charset=utf-8; profile=\"https://www.mediawiki.org/wiki/Specs/data-parsoid/1.7.0\"", "application/problem+json" ], "parameters": [ { "name": "title", "in": "path", "description": "Page title. Use underscores instead of spaces. Example: `Main_Page`.", "required": true, "type": "string" }, { "name": "revision", "in": "path", "description": "The revision", "required": true, "type": "integer" }, { "name": "tid", "in": "path", "description": "The revision's time ID", "required": true, "type": "string" }, { "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.\nTo get a 200 response instead, supply `false` to the `redirect` parameter.\n", "required": false, "type": "boolean" } ], "responses": { "200": { "description": "The latest Parsoid data for the given page", "headers": { "ETag": { "type": "string", "description": "Revision / tid: \"701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc\"" } }, "schema": { "$ref": "#/definitions/data-parsoid" } }, "301": { "description": "A permanent redirect is returned if the supplied article title was not in the normalized form.\nTo avoid this kind of redirect, you can use the [mediawiki-title](https://github.com/wikimedia/mediawiki-title) library to perform\ntitle normalization client-side.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "302": { "description": "The page is a [redirect page](https://www.mediawiki.org/wiki/Help:Redirects).\nThe `location` header points to the redirect target, and the body contains the actual data-parsoid for the redirect page.\nIf you would like to avoid automatically following redirect pages, set the `redirect=false` query parameter.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "400": { "description": "Invalid revision", "schema": { "$ref": "#/definitions/problem" } }, "403": { "description": "Access to the specific revision is restricted", "schema": { "$ref": "#/definitions/problem" } }, "404": { "description": "Unknown page, revision or tid", "schema": { "$ref": "#/definitions/problem" } }, "default": { "description": "Error", "schema": { "$ref": "#/definitions/problem" } } }, "x-monitor": false } }, "/page/lint/{title}{/revision}": { "get": { "tags": [ "Page content" ], "summary": "Get the linter errors for a specific title/revision.", "description": "Stability: [experimental](https://www.mediawiki.org/wiki/API_versioning#Experimental)\n", "produces": [ "application/json", "application/problem+json" ], "parameters": [ { "name": "title", "in": "path", "description": "Page title. Use underscores instead of spaces. Example: `Main_Page`.", "required": true, "type": "string" }, { "name": "revision", "in": "path", "description": "The revision", "required": false, "type": "integer" } ], "responses": { "200": { "description": "The lint errors for the given page and optionally revision.\n\nSee [the Linter extension docs](https://www.mediawiki.org/wiki/Extension:Linter) for more\ndetails.\n" }, "301": { "description": "A permanent redirect is returned if the supplied article title was not in the normalized form.\nTo avoid this kind of redirect, you can use the [mediawiki-title](https://github.com/wikimedia/mediawiki-title) library to perform\ntitle normalization client-side.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "302": { "description": "The page is a [redirect page](https://www.mediawiki.org/wiki/Help:Redirects).\nThe `location` header points to the redirect target, and the body contains the actual page revision contents as HTML.\nIf you would like to avoid automatically following redirect pages, set the `redirect=false` query parameter.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "400": { "description": "Invalid revision or tid", "schema": { "$ref": "#/definitions/problem" } }, "403": { "description": "Access to the specific revision is restricted", "schema": { "$ref": "#/definitions/problem" } }, "404": { "description": "Unknown page, revision or tid", "schema": { "$ref": "#/definitions/problem" } }, "default": { "description": "Error", "schema": { "$ref": "#/definitions/problem" } } }, "x-monitor": false } }, "/page/wikitext/{title}": { "post": { "tags": [ "Page content" ], "summary": "Save a new revision of a page using Wikitext.", "description": "For new pages, or when editting the latest revision of a page,\nthe `base_etag` parameter should be left empty.\nFor editing old revisions, it should contain the ETag header\nof the revision the edit is derived from.\n\nThe latest page revision ETag header should be provided in the If-Match header\nto detect edit conflicts. If the new page is created, appropriate user cookies\nmust be provided.\n\nStability: [unstable](https://www.mediawiki.org/wiki/API_versioning#Unstable)\n", "consumes": [ "multipart/form-data" ], "produces": [ "application/json", "application/problem+json" ], "parameters": [ { "name": "title", "in": "path", "description": "Page title. Use underscores instead of spaces. Example: `Main_Page`.", "required": true, "type": "string" }, { "name": "base_etag", "in": "formData", "description": "The ETag header of the revision the edit is based on.", "required": false, "type": "string" }, { "name": "wikitext", "in": "formData", "description": "The wikitext source of the page to save", "required": true, "type": "string", "x-textarea": true }, { "name": "csrf_token", "in": "formData", "description": "The CRSF edit token provided by the MW API", "required": true, "type": "string" }, { "name": "comment", "in": "formData", "description": "The summary of the change", "required": false, "type": "string" }, { "name": "is_minor", "in": "formData", "description": "Whether this represents a minor change", "required": false, "type": "boolean" }, { "name": "is_bot", "in": "formData", "description": "Whether the change is being made by a bot", "required": false, "type": "boolean" } ], "responses": { "200": { "description": "The existing revision of the page matches the sent text" }, "201": { "description": "A new revision of the page has been created", "headers": { "ETag": { "type": "string", "description": "ETag header indicating the new revision and timeuuid,\nseparated by a slash:\n\"701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc\"\n" } }, "schema": { "type": "object" } }, "400": { "description": "Invalid request - lack of required parameters, bad ETags etc.", "schema": { "$ref": "#/definitions/problem" } }, "409": { "description": "Edit conflict", "schema": { "$ref": "#/definitions/problem" } }, "default": { "description": "Error", "schema": { "$ref": "#/definitions/problem" } } }, "x-monitor": false } }, "/page/segments/{title}{/revision}": { "get": { "tags": [ "Page content" ], "summary": "Fetches a segmented page to be used in machine translation", "description": "Use this end point to fetch the segmented content of a page. Clients should\nuse the returned content in conjunction with the [language transform\nAPI](https://wikimedia.org/api/rest_v1/#!/Transform).\n\nStability: [experimental](https://www.mediawiki.org/wiki/API_versioning#Experimental)\n", "produces": [ "application/json", "application/problem+json" ], "parameters": [ { "name": "title", "in": "path", "description": "Page title. Use underscores instead of spaces. Example: `Main_Page`.", "required": true, "type": "string" }, { "name": "revision", "in": "path", "description": "The revision id", "required": false, "type": "integer" } ], "responses": { "200": { "description": "The segmented page for the given title and revision", "schema": { "$ref": "#/definitions/inline_response_200" } }, "400": { "description": "Invalid revision", "schema": { "$ref": "#/definitions/problem" } }, "403": { "description": "Access to the specific revision is restricted", "schema": { "$ref": "#/definitions/problem" } }, "404": { "description": "Unknown page or revision", "schema": { "$ref": "#/definitions/problem" } }, "default": { "description": "Error", "schema": { "$ref": "#/definitions/problem" } } }, "x-monitor": false } }, "/page/mobile-sections/{title}{/revision}": { "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\nnative mobile applications. Note that the output is split by sections.\n\nStability: [unstable](https://www.mediawiki.org/wiki/API_versioning#Unstable)\n", "produces": [ "application/json; charset=utf-8; profile=\"https://www.mediawiki.org/wiki/Specs/mobile-sections/0.14.1\"", "application/problem+json" ], "parameters": [ { "name": "title", "in": "path", "description": "Page title. Use underscores instead of spaces. Example: `Main_Page`.", "required": true, "type": "string" }, { "name": "revision", "in": "path", "description": "Optional page revision. Note that older revisions are not stored, so request latency with the revision would be higher.\n", "required": false, "type": "integer" }, { "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.\nTo get a 200 response instead, supply `false` to the `redirect` parameter.\n", "required": false, "type": "boolean" }, { "name": "Accept-Language", "in": "header", "description": "The desired language variant code for wikis where LanguageConverter is enabled. Example: `sr-el` for Latin transcription of the Serbian language.\n", "required": false, "type": "string" } ], "responses": { "200": { "description": "JSON containing HTML sections and metadata for the given page title.", "headers": { "ETag": { "description": "Syntax: \"{revision}/{tid}\". Example: \"701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc\"\n" } }, "schema": { "type": "object" } }, "301": { "description": "A permanent redirect is returned if the supplied article title was not in the normalized form.\nTo avoid this kind of redirect, you can use the [mediawiki-title](https://github.com/wikimedia/mediawiki-title) library to perform\ntitle normalization client-side.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "302": { "description": "The page is a [redirect page](https://www.mediawiki.org/wiki/Help:Redirects).\nThe `location` header points to the redirect target.\nIf you would like to avoid automatically following redirect pages, set the `redirect=false` query parameter.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "404": { "description": "Unknown page title", "schema": { "$ref": "#/definitions/problem" } }, "default": { "description": "Error", "schema": { "$ref": "#/definitions/problem" } } }, "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": "/.+/" } } } ] } }, "/page/mobile-sections-lead/{title}{/revision}": { "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\nfor viewing with native mobile applications.\n\nStability: [unstable](https://www.mediawiki.org/wiki/API_versioning#Unstable)\n", "produces": [ "application/json; charset=utf-8; profile=\"https://www.mediawiki.org/wiki/Specs/mobile-sections/0.14.1\"", "application/problem+json" ], "parameters": [ { "name": "title", "in": "path", "description": "Page title. Use underscores instead of spaces. Example: `Main_Page`.", "required": true, "type": "string" }, { "name": "revision", "in": "path", "description": "Optional page revision. Note that older revisions are not stored, so request latency with the revision would be higher.\n", "required": false, "type": "integer" }, { "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.\nTo get a 200 response instead, supply `false` to the `redirect` parameter.\n", "required": false, "type": "boolean" }, { "name": "Accept-Language", "in": "header", "description": "The desired language variant code for wikis where LanguageConverter is enabled. Example: `sr-el` for Latin transcription of the Serbian language.\n", "required": false, "type": "string" } ], "responses": { "200": { "description": "The HTML for the given page title.", "headers": { "ETag": { "description": "Syntax: \"{revision}/{tid}\". Example: \"701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc\"\n" } }, "schema": { "type": "object" } }, "301": { "description": "A permanent redirect is returned if the supplied article title was not in the normalized form.\nTo avoid this kind of redirect, you can use the [mediawiki-title](https://github.com/wikimedia/mediawiki-title) library to perform\ntitle normalization client-side.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "302": { "description": "The page is a [redirect page](https://www.mediawiki.org/wiki/Help:Redirects).\nThe `location` header points to the redirect target.\nIf you would like to avoid automatically following redirect pages, set the `redirect=false` query parameter.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "404": { "description": "Unknown page title", "schema": { "$ref": "#/definitions/problem" } }, "default": { "description": "Error", "schema": { "$ref": "#/definitions/problem" } } }, "x-monitor": false } }, "/page/mobile-sections-remaining/{title}{/revision}": { "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\na page title optimised for viewing with native mobile applications,\nprovided as a JSON object containing the sections.\n\nStability: [unstable](https://www.mediawiki.org/wiki/API_versioning#Unstable)\n", "produces": [ "application/json; charset=utf-8; profile=\"https://www.mediawiki.org/wiki/Specs/mobile-sections/0.14.1\"", "application/problem+json" ], "parameters": [ { "name": "title", "in": "path", "description": "Page title. Use underscores instead of spaces. Example: `Main_Page`.", "required": true, "type": "string" }, { "name": "revision", "in": "path", "description": "Optional page revision. Note that older revisions are not stored, so request latency with the revision would be higher.\n", "required": false, "type": "integer" }, { "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.\nTo get a 200 response instead, supply `false` to the `redirect` parameter.\n", "required": false, "type": "boolean" }, { "name": "Accept-Language", "in": "header", "description": "The desired language variant code for wikis where LanguageConverter is enabled. Example: `sr-el` for Latin transcription of the Serbian language.\n", "required": false, "type": "string" } ], "responses": { "200": { "description": "JSON wrapping HTML sections for the given page title.", "headers": { "ETag": { "description": "Syntax: \"{revision}/{tid}\". Example: \"701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc\"\n" } }, "schema": { "type": "object" } }, "301": { "description": "A permanent redirect is returned if the supplied article title was not in the normalized form.\nTo avoid this kind of redirect, you can use the [mediawiki-title](https://github.com/wikimedia/mediawiki-title) library to perform\ntitle normalization client-side.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "302": { "description": "The page is a [redirect page](https://www.mediawiki.org/wiki/Help:Redirects).\nThe `location` header points to the redirect target.\nIf you would like to avoid automatically following redirect pages, set the `redirect=false` query parameter.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "404": { "description": "Unknown page title", "schema": { "$ref": "#/definitions/problem" } }, "default": { "description": "Error", "schema": { "$ref": "#/definitions/problem" } } }, "x-monitor": false } }, "/page/graph/png/{title}/{revision}/{graph_id}": { "get": { "tags": [ "Page content" ], "summary": "Get PNG graph images referenced in page revisions.", "description": "Retrieve PNG graph images embedded in specific revisions of a\npage. See [the Graphoid\ndocumentation](https://www.mediawiki.org/wiki/Extension:Graph#Graphoid_service)\nfor details.\n\nStability: [unstable](https://www.mediawiki.org/wiki/API_versioning#Unstable)\n", "produces": [ "image/png", "application/problem+json" ], "parameters": [ { "name": "title", "in": "path", "description": "The page title", "required": true, "type": "string" }, { "name": "revision", "in": "path", "description": "The page revision, or 0 for the latest", "required": true, "type": "integer" }, { "name": "graph_id", "in": "path", "description": "The graph ID, consisting of a hash and the suffix `.png`.", "required": true, "type": "string" } ], "responses": { "200": { "description": "The PNG render of the requested graph.", "schema": { "type": "blob" } }, "403": { "description": "access to the specific revision is restricted", "schema": { "$ref": "#/definitions/problem" } }, "404": { "description": "Unknown page title or revision", "schema": { "$ref": "#/definitions/problem" } }, "default": { "description": "Error", "schema": { "$ref": "#/definitions/problem" } } }, "x-monitor": true, "x-amples": [ { "title": "Get a graph from Graphoid", "request": { "params": { "domain": "en.wikipedia.org", "title": "User:Pchelolo/Graph", "revision": 0, "graph_id": "c1c5d432407bd5fd7435f5edfb6fdb73ffd4bc9e.png" } }, "response": { "status": 200, "headers": { "content-type": "image/png" } } } ] } }, "/page/summary/{title}": { "get": { "tags": [ "Page content" ], "summary": "Get a text extract & thumb summary of a page.", "description": "The summary response includes a text extract of the first several\nsentences, as well as information about a thumbnail that represents\nthe page.\n\nStability: [stable](https://www.mediawiki.org/wiki/API_versioning#Stable)\n", "produces": [ "application/json; charset=utf-8; profile=\"https://www.mediawiki.org/wiki/Specs/Summary/1.3.7\"", "application/problem+json" ], "parameters": [ { "name": "title", "in": "path", "description": "Page title. Use underscores instead of spaces. Example: `Main_Page`.", "required": true, "type": "string" }, { "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.\nTo get a 200 response instead, supply `false` to the `redirect` parameter.\n", "required": false, "type": "boolean" }, { "name": "Accept-Language", "in": "header", "description": "The desired language variant code for wikis where LanguageConverter is enabled. Example: `sr-el` for Latin transcription of the Serbian language.\n", "required": false, "type": "string" } ], "responses": { "200": { "description": "The summary for the given page", "headers": { "ETag": { "description": "Syntax: \"{revision}/{tid}\". Example: \"701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc\"\n" } }, "schema": { "$ref": "#/definitions/summary" } }, "301": { "description": "A permanent redirect is returned if the supplied article title was not in the normalized form.\nTo avoid this kind of redirect, you can use the [mediawiki-title](https://github.com/wikimedia/mediawiki-title) library to perform\ntitle normalization client-side.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "302": { "description": "The page is a [redirect page](https://www.mediawiki.org/wiki/Help:Redirects).\nThe `location` header points to the redirect target.\nIf you would like to avoid automatically following redirect pages, set the `redirect=false` query parameter.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "404": { "description": "Unknown page title", "schema": { "$ref": "#/definitions/problem" } }, "default": { "description": "Error", "schema": { "$ref": "#/definitions/problem" } } }, "x-monitor": true, "x-amples": [ { "title": "Get summary from storage", "request": { "params": { "domain": "en.wikipedia.org", "title": "San_Francisco" } }, "response": { "status": 200, "headers": { "etag": "/.+/", "content-type": "/^application\\/json/" }, "body": { "extract": "/.+/", "extract_html": "/.+/", "thumbnail": { "source": "/^https:/" }, "originalimage": { "source": "/^https:/" }, "lang": "en", "dir": "ltr", "description": "/.+/" } } } ] } }, "/page/media/{title}{/revision}": { "get": { "tags": [ "Page content" ], "summary": "Get information on media files used on a page.", "description": "Gets the media items (images, audio, and video) in the order in which they appear on a\ngiven wiki page.\n\nStability: [experimental](https://www.mediawiki.org/wiki/API_versioning#Experimental)\n", "produces": [ "application/json; charset=utf-8; profile=\"https://www.mediawiki.org/wiki/Specs/Media/1.3.1\"", "application/problem+json" ], "parameters": [ { "name": "title", "in": "path", "description": "Page title. Use underscores instead of spaces. Example: `Main_Page`.", "required": true, "type": "string" }, { "name": "revision", "in": "path", "description": "Optional page revision. Note that older revisions are not stored, so request latency with the revision would be higher.\n", "required": false, "type": "integer" }, { "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.\nTo get a 200 response instead, supply `false` to the `redirect` parameter.\n", "required": false, "type": "boolean" } ], "responses": { "200": { "description": "JSON containing metadata of media items appearing on the given page.", "headers": { "ETag": { "description": "Syntax: \"{revision}/{tid}\". Example: \"701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc\"\n" } }, "schema": { "$ref": "#/definitions/media_list" } }, "301": { "description": "A permanent redirect is returned if the supplied article title was not in the normalized form.\nTo avoid this kind of redirect, you can use the [mediawiki-title](https://github.com/wikimedia/mediawiki-title) library to perform\ntitle normalization client-side.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "302": { "description": "The page is a [redirect page](https://www.mediawiki.org/wiki/Help:Redirects).\nThe `location` header points to the redirect target.\nIf you would like to avoid automatically following redirect pages, set the `redirect=false` query parameter.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "404": { "description": "Unknown page title", "schema": { "$ref": "#/definitions/problem" } }, "default": { "description": "Error", "schema": { "$ref": "#/definitions/problem" } } }, "x-monitor": false } }, "/page/metadata/{title}{/revision}": { "get": { "tags": [ "Page content" ], "summary": "Get additional metadata of a page.", "description": "Gets metadata of a page that's not already covered by the summary endpoint.\n\nStability: [experimental](https://www.mediawiki.org/wiki/API_versioning#Experimental)\n", "produces": [ "application/json; charset=utf-8; profile=\"https://www.mediawiki.org/wiki/Specs/Metadata/1.2.0\"", "application/problem+json" ], "parameters": [ { "name": "title", "in": "path", "description": "Page title. Use underscores instead of spaces. Example: `Main_Page`.", "required": true, "type": "string" }, { "name": "revision", "in": "path", "description": "Optional page revision. Note that older revisions are not stored, so request latency with the revision would be higher.\n", "required": false, "type": "integer" }, { "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.\nTo get a 200 response instead, supply `false` to the `redirect` parameter.\n", "required": false, "type": "boolean" } ], "responses": { "200": { "description": "JSON containing additional metadata of the given page.", "headers": { "ETag": { "description": "Syntax: \"{revision}/{tid}\". Example: \"701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc\"\n" } }, "schema": { "$ref": "#/definitions/metadata" } }, "301": { "description": "A permanent redirect is returned if the supplied article title was not in the normalized form.\nTo avoid this kind of redirect, you can use the [mediawiki-title](https://github.com/wikimedia/mediawiki-title) library to perform\ntitle normalization client-side.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "302": { "description": "The page is a [redirect page](https://www.mediawiki.org/wiki/Help:Redirects).\nThe `location` header points to the redirect target.\nIf you would like to avoid automatically following redirect pages, set the `redirect=false` query parameter.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "404": { "description": "Unknown page title", "schema": { "$ref": "#/definitions/problem" } }, "default": { "description": "Error", "schema": { "$ref": "#/definitions/problem" } } }, "x-monitor": false } }, "/page/references/{title}{/revision}": { "get": { "tags": [ "Page content" ], "summary": "Get references of a page.", "description": "Gets references of a page in a way that makes it easy to look up the details of a reference by id\nand allow some reference lists to be rebuild.\n\nStability: [experimental](https://www.mediawiki.org/wiki/API_versioning#Experimental)\n", "produces": [ "application/json; charset=utf-8; profile=\"https://www.mediawiki.org/wiki/Specs/References/1.0.0\"", "application/problem+json" ], "parameters": [ { "name": "title", "in": "path", "description": "Page title. Use underscores instead of spaces. Example: `Main_Page`.", "required": true, "type": "string" }, { "name": "revision", "in": "path", "description": "Optional page revision. Note that older revisions are not stored, so request latency with the revision would be higher.\n", "required": false, "type": "integer" }, { "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.\nTo get a 200 response instead, supply `false` to the `redirect` parameter.\n", "required": false, "type": "boolean" } ], "responses": { "200": { "description": "JSON containing a structure of references on the given page.", "headers": { "ETag": { "description": "Syntax: \"{revision}/{tid}\". Example: \"701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc\"\n" } }, "schema": { "$ref": "#/definitions/references_response" } }, "301": { "description": "A permanent redirect is returned if the supplied article title was not in the normalized form.\nTo avoid this kind of redirect, you can use the [mediawiki-title](https://github.com/wikimedia/mediawiki-title) library to perform\ntitle normalization client-side.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "302": { "description": "The page is a [redirect page](https://www.mediawiki.org/wiki/Help:Redirects).\nThe `location` header points to the redirect target.\nIf you would like to avoid automatically following redirect pages, set the `redirect=false` query parameter.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "404": { "description": "Unknown page title", "schema": { "$ref": "#/definitions/problem" } }, "default": { "description": "Error", "schema": { "$ref": "#/definitions/problem" } } }, "x-monitor": false } }, "/page/mobile-html/{title}{/revision}": { "get": { "tags": [ "Page content" ], "summary": "Get page content HTML optimized for mobile consumption.", "description": "Gets the content HTML optimized for mobile consumption for the given page. This content\nis derived from Parsoid HTML (see `/page/html/{title}` endpoint).\nThe difference to Parsoid HTML is roughly:\n* Some elements and attributes not needed for the reading case are removed.\n* LeadIntroductionTransform: The introductory paragraph is moved before an infobox.\n* RedLinks: Red links are flattened (=turned into span elements).\n* WidenImage: images that should be displayed in gallery are widened.\n* Section headings are slightly changed by wrapping the headings inside a div and adding\n a span element inside the new div for the edit buttons.\n* Additional classes are added to img elements to fix issues with non-white backgrounds.\n See Theme support below for instructions on how to enable that.\n* Pagelib CSS files needed to display the content are referenced.\n* LazyLoadTransform: server-side portion/prep for lazy loading of images.\n* CollapseTable: server-side portion/prep for collapsing tables.\n\nWhat's not included? What parts of the PageLibrary does a client still have to do?\n* Theme support: Themes can be turned on by adding a theme class to the root <html> tag.\n Possible class names are:\n * `pagelib_theme_default`\n * `pagelib_theme_dark`\n * `pagelib_theme_black`\n * `pagelib_theme_sepia`\n\n The pagelib JS has functionality to do that: ThemeTransform.setTheme(document, theme).\n* Dim images: DimImagesTransform.dim(window, enable)\n* PlatformTransform.classify(window) to trigger Android and iOS app specific CSS rules\n* LazyLoadTransformer: client side companion of LazyLoadTransform (note the extra *er*\nhere)\n* FooterTransformer: seems to be more UI than content, requires I18N, too\n\nStability: [experimental](https://www.mediawiki.org/wiki/API_versioning#Experimental)\n", "produces": [ "text/html; charset=utf-8; profile=\"https://www.mediawiki.org/wiki/Specs/Mobile-HTML/1.0.0\"", "application/problem+json" ], "parameters": [ { "name": "title", "in": "path", "description": "Page title. Use underscores instead of spaces. Example: `Main_Page`.", "required": true, "type": "string" }, { "name": "revision", "in": "path", "description": "Optional page revision. Note that older revisions are not stored, so request latency with the revision would be higher.\n", "required": false, "type": "integer" }, { "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.\nTo get a 200 response instead, supply `false` to the `redirect` parameter.\n", "required": false, "type": "boolean" } ], "responses": { "200": { "description": "mobile-optimized HTML of the given page.", "headers": { "ETag": { "description": "Syntax: \"{revision}/{tid}\". Example: \"701384379/154d7bca-c264-11e5-8c2f-1b51b33b59fc\"\n" } } }, "301": { "description": "A permanent redirect is returned if the supplied article title was not in the normalized form.\nTo avoid this kind of redirect, you can use the [mediawiki-title](https://github.com/wikimedia/mediawiki-title) library to perform\ntitle normalization client-side.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "302": { "description": "The page is a [redirect page](https://www.mediawiki.org/wiki/Help:Redirects).\nThe `location` header points to the redirect target.\nIf you would like to avoid automatically following redirect pages, set the `redirect=false` query parameter.\n\nBeware that redirected pre-flighted cross-origin requests (such as those sending custom request headers like `Api-User-Agent`)\nwill fail in most current browsers [due to a spec bug](https://github.com/whatwg/fetch/issues/204).\n" }, "404": { "description": "Unknown page title", "schema": { "$ref": "#/definitions/problem" } }, "default": { "description": "Error", "schema": { "$ref": "#/definitions/problem" } } }, "x-monitor": false } } }, "securityDefinitions": {}, "definitions": { "revisions": { "required": [ "items" ], "properties": { "items": { "$ref": "#/definitions/revisionIdentifier" } }, "description": "The result format for revision listing" }, "listing": { "required": [ "items" ], "properties": { "items": { "type": "array", "items": { "type": "string" } }, "_links": { "$ref": "#/definitions/listing__links" } }, "description": "The result format for listings" }, "data-parsoid": { "required": [ "counter", "ids" ], "properties": { "counter": { "type": "integer", "format": "int32" }, "ids": { "type": "object", "properties": {} } }, "description": "Result format for Parsoid data queries" }, "revision": { "required": [ "count", "items" ], "properties": { "count": { "type": "integer", "format": "int32" }, "items": { "$ref": "#/definitions/revisionInfo" } }, "description": "Result format for revision items" }, "revisionInfo": { "properties": { "title": { "type": "string" }, "page_id": { "type": "integer", "format": "int32" }, "rev": { "type": "integer", "format": "int32" }, "tid": { "type": "string" }, "comment": { "type": "string" }, "restrictions": { "type": "array", "items": { "type": "string" } }, "tags": { "type": "array", "items": { "type": "string" } }, "user_id": { "type": "integer", "format": "int32" }, "user_text": { "type": "string" }, "timestamp": { "type": "string", "format": "date-time" }, "redirect": { "type": "boolean" }, "page_language": { "type": "string" } }, "description": "Complete information about the revision" }, "revisionIdentifier": { "properties": { "revision": { "type": "integer", "format": "int32" }, "tid": { "type": "string" } }, "description": "Unique revision identifier" }, "media_list": { "type": "object", "required": [ "items", "revision", "tid" ], "properties": { "revision": { "type": "string", "description": "the revision ID used to create the list" }, "tid": { "type": "string", "description": "the time uuid of the page rendering used to create the list" }, "items": { "type": "array", "description": "a list of media items", "items": { "$ref": "#/definitions/media_item" } } } }, "media_item": { "type": "object", "required": [ "file_page", "titles", "type" ], "properties": { "titles": { "$ref": "#/definitions/titles_set" }, "thumbnail": { "$ref": "#/definitions/media_item_thumbnail" }, "original": { "$ref": "#/definitions/media_item_original" }, "page_count": { "type": "integer", "description": "page count, if the item is a paged item (PDF, TIFF, DjVu, etc.)" }, "file_page": { "type": "string", "description": "Full URL to the file page for the item on Wikimedia Commons" }, "type": { "type": "string", "enum": [ "image", "video", "audio" ] }, "caption": { "$ref": "#/definitions/media_item_caption" }, "start_time": { "type": "number", "description": "start time (if any) for the media item" }, "end_time": { "type": "number", "description": "end time (if any) for the media item" }, "duration": { "type": "number", "description": "the playback duration in seconds (for audio and video items)" }, "sources": { "type": "array", "description": "a list of derivatives of the original file (applies only to videos)", "items": { "type": "object", "properties": {} } }, "artist": { "$ref": "#/definitions/media_item_artist" }, "credit": { "type": "string", "description": "source of the media item" }, "license": { "$ref": "#/definitions/media_item_license" }, "license_url": { "type": "string", "description": "URL for the pertinent license" }, "description": { "$ref": "#/definitions/media_item_description" } } }, "titles_set": { "type": "object", "required": [ "canonical", "display", "normalized" ], "properties": { "canonical": { "type": "string", "description": "the DB key (non-prefixed)" }, "normalized": { "type": "string", "description": "the normalized title (https://www.mediawiki.org/wiki/API:Query#Title_normalization)" }, "display": { "type": "string", "description": "the title as it should be displayed to the user" } } }, "metadata": { "type": "object", "required": [ "protection", "revision", "tid" ], "properties": { "revision": { "type": "string", "description": "revision ID for the page" }, "tid": { "type": "string", "description": "time UUID for the page/revision" }, "hatnotes": { "type": "array", "description": "the hatnotes on the page, with html and plaintext representations provided for each", "items": { "$ref": "#/definitions/hatnote_or_page_issue" } }, "issues": { "type": "array", "description": "the page issues on the page, with html and plaintext representations provided for each", "items": { "$ref": "#/definitions/hatnote_or_page_issue" } }, "toc": { "$ref": "#/definitions/metadata_toc" }, "language_links": { "type": "array", "description": "list of titles and language codes for the article topic on other language Wikipedias", "items": { "$ref": "#/definitions/metadata_language_links" } }, "categories": { "type": "array", "description": "categories the page belongs to", "items": { "$ref": "#/definitions/category" } }, "protection": { "type": "object", "description": "info on page edit and move rights", "properties": {} }, "description_source": { "type": "string", "description": "Whether the description is defined locally or comes from Wikidata. May be 'central' or 'local'.", "enum": [ "central", "local" ] }, "variants": { "type": "object", "properties": {} } } }, "hatnote_or_page_issue": { "type": "object", "required": [ "html", "section" ], "properties": { "section": { "type": "integer", "description": "section ID containing the hatnote or page issue" }, "html": { "type": "string", "description": "the hatnote or page issue HTML" } } }, "toc_entry": { "type": "object", "required": [ "anchor", "html", "level", "number", "section" ], "properties": { "level": { "type": "integer", "description": "the depth of the heading in the TOC hierarchy" }, "section": { "type": "integer", "description": "the position of the section in the order of appearance of all sections on the page" }, "number": { "type": "string", "description": "a numeric representation of the section's position in the page hierarhcy (e.g., '1', '1.3', '1.3.2')" }, "anchor": { "type": "string", "description": "the heading text to be used in constracting a page anchor for linking" }, "html": { "type": "string", "description": "the heading display text (may contain HTML markup)" } } }, "category": { "type": "object", "required": [ "hidden", "ns", "summary_url", "titles" ], "properties": { "titles": { "$ref": "#/definitions/category_titles" }, "summary_url": { "type": "string", "description": "link to REST API summary" }, "hidden": { "type": "boolean", "description": "whether the category is hidden or not" }, "ns": { "type": "integer", "description": "the numeric namespace id for the category page" } } }, "protection": { "type": "object", "properties": { "edit": { "type": "array", "description": "list of groups with the 'edit' permission", "items": { "type": "string" } }, "move": { "type": "array", "description": "list of groups with the 'move' permission", "items": { "type": "string" } } } }, "references_response": { "type": "object", "required": [ "reference_lists", "references_by_id", "revision", "tid" ], "properties": { "revision": { "type": "string", "description": "revision ID for the page" }, "tid": { "type": "string", "description": "time UUID for the page/revision" }, "reference_lists": { "$ref": "#/definitions/reference_lists" }, "references_by_id": { "$ref": "#/definitions/references_by_id" } }, "description": "Reference lists and references" }, "reference_lists": { "type": "array", "description": "A list of reference lists", "items": { "$ref": "#/definitions/reference_list" } }, "reference_list": { "type": "object", "required": [ "order" ], "properties": { "section_heading": { "$ref": "#/definitions/reference_list_section_heading" }, "order": { "type": "array", "description": "List of identifiers for individual references, which can be used to lookup\nthe reference details in references_by_id.\n", "items": { "type": "string" } } }, "description": "A single reference list" }, "references_by_id": { "type": "object", "properties": { "default": { "$ref": "#/definitions/reference_detail_item" } }, "description": "A map of reference ids to reference details" }, "reference_detail_item": { "type": "object", "properties": { "back_links": { "type": "array", "description": "A list of back links, can be empty in rare cases", "items": { "$ref": "#/definitions/reference_detail_item_back_link" } }, "content": { "$ref": "#/definitions/reference_detail_item_content" } }, "description": "Information about one reference" }, "reference_detail_item_back_link": { "type": "object", "required": [ "href", "text" ], "properties": { "href": { "type": "string", "description": "Relative URL pointing to anchor on same page" }, "text": { "type": "string", "description": "Either an arrow for a single back link or another (usually single) chararacter\nto distinguish multiple back links.\n" } }, "description": "Information about one link back to where on the page a given reference was used" }, "related": { "type": "object", "properties": { "pages": { "type": "array", "items": { "$ref": "#/definitions/summary" } } } }, "problem": { "required": [ "type" ], "properties": { "type": { "type": "string" }, "title": { "type": "string" }, "detail": { "type": "string" }, "instance": { "type": "string" } } }, "originalimage": { "type": "object", "required": [ "height", "source", "width" ], "properties": { "source": { "type": "string", "description": "Original image URI" }, "width": { "type": "integer", "description": "Original image width" }, "height": { "type": "integer", "description": "Original image height" } } }, "thumbnail": { "type": "object", "required": [ "height", "source", "width" ], "properties": { "source": { "type": "string", "description": "Thumbnail image URI" }, "width": { "type": "integer", "description": "Thumbnail width" }, "height": { "type": "integer", "description": "Thumnail height" } } }, "summary": { "type": "object", "required": [ "dir", "extract", "lang", "title" ], "properties": { "title": { "type": "string", "description": "The page title" }, "displaytitle": { "type": "string", "description": "The page title how it should be shown to the user" }, "pageid": { "type": "integer", "description": "The page ID" }, "extract": { "type": "string", "description": "First several sentences of an article in plain text" }, "extract_html": { "type": "string", "description": "First several sentences of an article in simple HTML format" }, "thumbnail": { "$ref": "#/definitions/thumbnail" }, "originalimage": { "$ref": "#/definitions/originalimage" }, "lang": { "type": "string", "example": "en", "description": "The page language code" }, "dir": { "type": "string", "example": "ltr", "description": "The page language direction code" }, "timestamp": { "type": "string", "example": "1970-01-01T00:00:00.000Z", "description": "The time when the page was last editted in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format" }, "description": { "type": "string", "example": "American poet", "description": "Wikidata description for the page" }, "coordinates": { "$ref": "#/definitions/summary_coordinates" } } }, "cx_mt": { "type": "object", "properties": { "contents": { "type": "string", "description": "the translated content" } } }, "cx_dict": { "type": "object", "properties": { "source": { "type": "string", "description": "the original word to look up" }, "translations": { "type": "array", "description": "the translations found", "items": { "$ref": "#/definitions/cx_dict_translations" } } } }, "mostread_article": { "type": "object", "required": [ "normalizedtitle", "rank", "title", "views" ], "properties": { "title": { "type": "string", "description": "Article title in a form of DB key" }, "normalizedtitle": { "type": "string", "description": "Article title as it should be presented to the user" }, "views": { "type": "integer", "description": "Number of views on the requested day" }, "rank": { "type": "integer", "description": "Position in the list of most viewed articles" }, "thumbnail": { "description": "Lead image for the article", "$ref": "#/definitions/thumbnail" }, "description": { "type": "string", "description": "Wikidata description of the article" }, "extract": { "type": "string", "description": "First several sentences of an article in plain text" } } }, "mostread": { "type": "object", "required": [ "articles", "date" ], "properties": { "date": { "type": "string", "description": "The date which the data correspond to" }, "articles": { "type": "array", "description": "Array of most popular articles", "items": { "$ref": "#/definitions/mostread_article" } } } }, "news_item": { "type": "object", "required": [ "links", "story" ], "properties": { "story": { "type": "string", "description": "A cover story for the news item" }, "links": { "type": "array", "description": "A collection of articles related to the news item", "items": { "$ref": "#/definitions/summary" } } } }, "news": { "type": "array", "items": { "$ref": "#/definitions/news_item" } }, "image_description": { "required": [ "lang", "text" ], "properties": { "text": { "type": "string", "description": "Text of the description" }, "lang": { "type": "string", "description": "Language code of the description" } } }, "image": { "type": "object", "required": [ "image", "thumbnail", "title" ], "properties": { "title": { "type": "string", "description": "Image title" }, "thumbnail": { "description": "Image thumbnail", "$ref": "#/definitions/thumbnail" }, "image": { "description": "Full-size image", "$ref": "#/definitions/thumbnail" }, "description": { "$ref": "#/definitions/image_description" } } }, "onthisday": { "type": "array", "items": { "$ref": "#/definitions/onthisday_inner" } }, "feed": { "type": "object", "properties": { "tfa": { "description": "Data about the featured article of the day", "$ref": "#/definitions/summary" }, "mostread": { "description": "Data about most viewed articles", "$ref": "#/definitions/mostread" }, "news": { "description": "Data about in the news section", "$ref": "#/definitions/news" }, "image": { "description": "Featured image for a given date", "$ref": "#/definitions/image" }, "onthisday": { "description": "List of featured events that happend on this day", "$ref": "#/definitions/onthisday" } }, "description": "Aggregated feed content for a given date" }, "action": { "type": "object", "required": [ "title", "url" ], "properties": { "title": { "type": "string", "description": "The title to display on the button that performs the action" }, "url": { "type": "string", "description": "The URL to navigate to when the button is pressed" } } }, "announcement": { "type": "object", "required": [ "countries", "end_time", "id", "platforms", "start_time", "text", "type" ], "properties": { "id": { "type": "string", "description": "Unique ID of the announcement" }, "type": { "type": "string", "description": "The type of announcement. Possible values are \"survey\" or \"fundraising\"" }, "start_time": { "type": "string", "description": "The date to begin showing the announcement" }, "end_time": { "type": "string", "description": "The date to stop showing the announcement" }, "platforms": { "type": "array", "description": "An array of platforms to display the announcement. Possible values are \"iOSApp\" or \"AndroidApp\"", "items": { "type": "string" } }, "text": { "type": "string", "description": "The text of the announcement" }, "image": { "type": "string", "description": "The URL of the image for the announcement" }, "action": { "type": "object", "description": "The action for the button of the announcement", "properties": {} }, "caption_HTML": { "type": "string", "description": "HTML to display below the announcement. Usually a privacy statment and link to a policy" }, "countries": { "type": "array", "description": "An array of country codes in which to display the announcement.\nClients should derive the country from 'GeoIP' portion of the Set-Cookie header\n", "items": { "type": "string" } } } }, "announcementsResponse": { "type": "object", "required": [ "announce" ], "properties": { "announce": { "type": "array", "items": { "type": "object", "properties": {} } } } }, "onthisdayResponse": { "type": "object", "properties": { "births": { "description": "A list of birthdays which happened on the provided day and month", "$ref": "#/definitions/onthisday" }, "deaths": { "description": "A list of deaths which happened on the provided day and month", "$ref": "#/definitions/onthisday" }, "events": { "description": "A list of significant events which happened on the provided day and month and which are not covered by the other types yet", "$ref": "#/definitions/onthisday" }, "holidays": { "description": "A list of fixed holidays celebrated on the provided day and month", "$ref": "#/definitions/onthisday" }, "selected": { "description": "A list of a few selected anniversaries which occur on the provided day and month; often the entries are curated for the current year", "$ref": "#/definitions/onthisday" } }, "description": "Lists of events which happened on the provided day and month" }, "result": { "required": [ "itemType", "title", "url" ], "properties": { "itemType": { "type": "string" }, "title": { "type": "string" }, "url": { "type": "string" } } }, "list_read": { "type": "object", "required": [ "created", "id", "name", "updated" ], "properties": { "id": { "type": "integer", "example": 42 }, "name": { "type": "string", "example": "Planets" }, "description": { "type": "string", "example": "Planets of the Solar System" }, "created": { "type": "string", "format": "date-time", "description": "Creation date (in ISO 8601)" }, "updated": { "type": "string", "format": "date-time", "description": "Last modification date (in ISO 8601)" } }, "title": "list" }, "list_write": { "type": "object", "required": [ "name" ], "properties": { "name": { "type": "string", "example": "Planets" }, "description": { "type": "string", "example": "Planets of the Solar System" } }, "title": "list" }, "list_entry_read": { "type": "object", "properties": { "id": { "type": "integer", "example": 64 }, "project": { "type": "string", "example": "https://en.wikipedia.org", "description": "Domain of the wiki containing the page." }, "title": { "type": "string", "example": "Barack_Obama", "description": "Title of the page containing the page, in database format." }, "created": { "type": "string", "format": "date-time", "description": "Creation date (in ISO 8601)" }, "updated": { "type": "string", "format": "date-time", "description": "Last modification date (in ISO 8601)" } }, "title": "list_entry" }, "list_entry_write": { "type": "object", "required": [ "project", "title" ], "properties": { "project": { "type": "string", "example": "https://en.wikipedia.org", "description": "Domain of the wiki containing the page." }, "title": { "type": "string", "example": "Barack_Obama", "description": "Title of the page containing the page, in database format." } } }, "recommendation_result": { "type": "object", "properties": { "count": { "type": "integer", "description": "the number of recommendations returned" }, "items": { "type": "array", "description": "the list of articles recommended for translation", "items": { "$ref": "#/definitions/recommendation_result_items" } } } }, "inline_response_200": { "type": "object", "properties": { "sourceLanguage": { "type": "string", "description": "The source language of the page" }, "title": { "type": "string", "description": "The title of the segmented page returned" }, "revision": { "type": "integer", "description": "The revision ID of the segmented page" }, "segmentedContent": { "type": "string", "description": "The segmented HTML body of the contents of the page" } } }, "listing__links_next": { "type": "object", "properties": { "href": { "type": "string", "description": "Relative link to next result page." } } }, "listing__links": { "type": "object", "properties": { "next": { "$ref": "#/definitions/listing__links_next" } } }, "media_item_thumbnail": { "type": "object", "properties": { "source": { "type": "string", "description": "thumb URL" }, "width": { "type": "integer", "description": "thumb width" }, "height": { "type": "integer", "description": "thumb height" }, "mime": { "type": "string", "description": "thumb MIME type" } } }, "media_item_original": { "type": "object", "properties": { "source": { "type": "string", "description": "original URL" }, "width": { "type": "integer", "description": "original width" }, "height": { "type": "integer", "description": "original height" }, "mime": { "type": "string", "description": "original MIME type" }, "size": { "type": "integer", "description": "the original file size in bytes (sizes are not provided for video derivatives)" } } }, "media_item_caption": { "type": "object", "properties": { "html": { "type": "string", "description": "on-wiki caption for the media item, including all HTML markup" }, "text": { "type": "string", "description": "plain text of the on-wiki caption for the media item" } } }, "media_item_artist": { "type": "object", "required": [ "html" ], "properties": { "html": { "type": "string", "description": "HTML string describing the artist" }, "name": { "type": "string", "description": "the plain text artist name, if available" }, "user_page": { "type": "string", "description": "Wikimedia Commons user page for the artist, if available" } }, "description": "structured info about the author of the media item" }, "media_item_license": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "description": "license type" }, "url": { "type": "string", "description": "URL describing the terms and conditions of the license, if any" } }, "description": "license under which the media item is available on Wikimedia Commons" }, "media_item_description": { "type": "object", "required": [ "html", "text" ], "properties": { "html": { "type": "string", "description": "html image description" }, "text": { "type": "string", "description": "plain text image description" } }, "description": "description of the image from Wikimedia Commons" }, "metadata_toc": { "type": "object", "required": [ "entries", "title" ], "properties": { "title": { "type": "string", "description": "the TOC title string for the wiki as reported by siteinfo" }, "entries": { "type": "array", "description": "section info for the TOC in structured form", "items": { "$ref": "#/definitions/toc_entry" } } }, "description": "a table of contents for the page, in structured form" }, "metadata_titles": { "type": "object", "required": [ "canonical", "normalized" ], "properties": { "canonical": { "type": "string", "description": "canonical title" }, "normalized": { "type": "string", "description": "normalized title" } }, "description": "titles dictionary" }, "metadata_language_links": { "type": "object", "required": [ "lang", "summary_url", "titles" ], "properties": { "lang": { "type": "string", "description": "language code" }, "titles": { "$ref": "#/definitions/metadata_titles" }, "summary_url": { "type": "string", "description": "link to REST API summary" } }, "description": "titles and language codes for the article topic on another language Wikipedia" }, "category_titles": { "type": "object", "required": [ "canonical", "display", "normalized" ], "properties": { "canonical": { "type": "string", "description": "canonical title" }, "normalized": { "type": "string", "description": "normalized title" }, "display": { "type": "string", "description": "display title (omitting the \"Category:\" namespace prefix)" } }, "description": "titles dictionary" }, "reference_list_section_heading": { "type": "object", "properties": { "id": { "type": "string", "description": "Identifier for the section, which can be used to link to it" }, "html": { "type": "string", "description": "HTML content of section heading" } }, "description": "Object containing information about the section heading this reference list\nis shown in.\n" }, "reference_detail_item_content": { "type": "object", "properties": { "html": { "type": "string", "description": "HTML representation of the reference content" }, "type": { "type": "string", "description": "Known citation type if there is exactly one cite tag, else 'generic'", "enum": [ "generic", "book", "journal", "news", "web" ] } } }, "summary_coordinates": { "type": "object", "properties": { "lat": { "type": "number", "description": "The latitude" }, "lon": { "type": "number", "description": "The longitude" } }, "description": "The coordinates of the item" }, "cx_dict_translations": { "type": "object", "properties": { "phrase": { "type": "string", "description": "the translated phrase" }, "info": { "type": "string", "description": "extra information about the phrase" }, "sources": { "type": "string", "description": "the source dictionary used for the translation" } } }, "onthisday_inner": { "type": "object", "properties": { "text": { "type": "string", "description": "Short description of the event" }, "pages": { "type": "array", "description": "List of pages related to the event", "items": { "$ref": "#/definitions/summary" } } } }, "recommendation_result_items": { "type": "object", "properties": { "wikidata_id": { "type": "string", "description": "wikidata id for the item" }, "title": { "type": "string", "description": "title of the article in the source language" }, "sitelink_count": { "type": "integer", "description": "count of sites the wikidata item is linked to" } } } }, "x-host-basePath": "/api/rest_v1", "x-default-params": {}
}