{ "openapi": "3.0.1", "info": { "version": "1.0.0", "title": "Wikimedia REST API", "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### Metrics endpoints\nFor documentation for `/metrics` endpoints, including pageviews, unique devices, edited pages, editors, edits, registered users, bytes difference, and mediarequests data, see the [Wikimedia Analytics API documentation](https://doc.wikimedia.org/analytics-api).\n", "termsOfService": "https://wikimediafoundation.org/wiki/Terms_of_Use", "contact": { "name": "the Wikimedia Services team", "url": "http://mediawiki.org/wiki/REST_API" }, "license": { "name": "Software available under the Apache 2 license", "url": "http://www.apache.org/licenses/LICENSE-2.0" }, "x-jentic-source-url": "https://wikimedia.org/api/rest_v1/?spec" }, "servers": [ { "url": "https://wikimedia.org/api/rest_v1" } ], "paths": { "/media/math/check/{type}": { "post": { "tags": [ "Math" ], "summary": "Check and normalize a TeX formula.", "description": "Checks the supplied TeX formula for correctness and returns the\n normalised formula representation as well as information about\nidentifiers. Available types are tex and inline-tex. The response\ncontains the `x-resource-location` header which can be used to retrieve\nthe render of the checked formula in one of the supported rendering\nformats. Just append the value of the header to `/media/math/{format}/`\nand perform a GET request against that URL.\n\n Stability: [stable](https://www.mediawiki.org/wiki/API_versioning#Stable).\n", "parameters": [ { "name": "type", "in": "path", "description": "The input type of the given formula; can be tex or inline-tex", "required": true, "schema": { "type": "string", "enum": [ "tex", "inline-tex", "chem" ] } } ], "requestBody": { "content": { "multipart/form-data": { "schema": { "required": [ "q" ], "properties": { "q": { "type": "string", "description": "The formula to check" } } } } }, "required": true }, "responses": { "200": { "description": "Information about the checked formula", "content": { "application/json": { "schema": { "type": "object" } } } }, "400": { "description": "Invalid type", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/problem" } } } }, "default": { "description": "Error", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/problem" } } } } }, "x-monitor": true, "x-amples": [ { "title": "Mathoid - check test formula", "request": { "params": { "domain": "wikimedia.org", "type": "tex" }, "body": { "q": "E=mc^{2}" } }, "response": { "status": 200, "headers": { "content-type": "/^application\\/json/", "x-resource-location": "/.+/", "cache-control": "no-cache" }, "body": { "success": true, "checked": "/.+/" } } } ] } }, "/media/math/formula/{hash}": { "get": { "tags": [ "Math" ], "summary": "Get a previously-stored formula", "description": "Returns the previously-stored formula via `/media/math/check/{type}` for\nthe given hash.\n\nStability: [stable](https://www.mediawiki.org/wiki/API_versioning#Stable).\n", "parameters": [ { "name": "hash", "in": "path", "description": "The hash string of the previous POST data", "required": true, "schema": { "minLength": 1, "type": "string" } } ], "responses": { "200": { "description": "Information about the checked formula", "content": { "application/json": { "schema": { "type": "object" } } } }, "404": { "description": "Data for the given hash cannot be found", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/problem" } } } }, "default": { "description": "Error", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/problem" } } } } }, "x-monitor": false } }, "/media/math/render/{format}/{hash}": { "get": { "tags": [ "Math" ], "summary": "Get rendered formula in the given format.", "description": "Given a request hash, renders a TeX formula into its mathematic\n representation in the given format. When a request is issued to the\n`/media/math/check/{format}` POST endpoint, the response contains the\n`x-resource-location` header denoting the hash ID of the POST data. Once\nobtained, this endpoint has to be used to obtain the actual render.\n\nStability: [stable](https://www.mediawiki.org/wiki/API_versioning#Stable).\n", "parameters": [ { "name": "format", "in": "path", "description": "The output format; can be svg or mml", "required": true, "schema": { "type": "string", "enum": [ "svg", "mml", "png" ] } }, { "name": "hash", "in": "path", "description": "The hash string of the previous POST data", "required": true, "schema": { "minLength": 1, "type": "string" } } ], "responses": { "200": { "description": "The rendered formula", "content": { "image/svg+xml": { "schema": { "type": "string" } }, "application/mathml+xml": { "schema": { "type": "string" } } } }, "404": { "description": "Unknown format or hash ID", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/problem" } } } }, "default": { "description": "Error", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/problem" } } } } }, "x-monitor": false } } }, "components": { "schemas": { "problem": { "required": [ "type" ], "type": "object", "properties": { "type": { "type": "string" }, "title": { "type": "string" }, "detail": { "type": "string" }, "instance": { "type": "string" } } }, "originalimage": { "type": "object", "properties": { "source": { "type": "string", "description": "Original image URI" }, "width": { "type": "integer", "description": "Original image width" }, "height": { "type": "integer", "description": "Original image height" } }, "required": [ "height", "source", "width" ] }, "thumbnail": { "type": "object", "properties": { "source": { "type": "string", "description": "Thumbnail image URI" }, "width": { "type": "integer", "description": "Thumbnail width" }, "height": { "type": "integer", "description": "Thumnail height" } }, "required": [ "height", "source", "width" ] }, "titles_set": { "type": "object", "description": "a good example of the differences can be seen in https://en.wikipedia.org/api/rest_v1/page/summary/IOS_13", "properties": { "canonical": { "type": "string", "description": "the DB key (non-prefixed), e.g. may have _ instead of spaces, best for making request URIs, still requires Percent-encoding" }, "normalized": { "type": "string", "description": "the normalized title (https://www.mediawiki.org/wiki/API:Query#Example_2:_Title_normalization), e.g. may have spaces instead of _" }, "display": { "type": "string", "description": "the title as it should be displayed to the user" } }, "required": [ "canonical", "normalized", "display" ] }, "summary": { "type": "object", "properties": { "titles": { "$ref": "#/components/schemas/titles_set" }, "title": { "deprecated": true, "type": "string", "description": "The page title.\nDeprecated: Use `titles.normalized` instead.\n" }, "displaytitle": { "deprecated": true, "type": "string", "description": "The page title how it should be shown to the user.\nDeprecated: Use `titles.display` instead.\n" }, "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": "#/components/schemas/thumbnail" }, "originalimage": { "$ref": "#/components/schemas/originalimage" }, "lang": { "type": "string", "description": "The page language code", "example": "en" }, "dir": { "type": "string", "description": "The page language direction code", "example": "ltr" }, "timestamp": { "type": "string", "description": "The time when the page was last edited in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format", "example": {} }, "description": { "type": "string", "description": "Wikidata description for the page", "example": "American poet" }, "coordinates": { "type": "object", "description": "The coordinates of the item", "properties": { "lat": { "type": "number", "description": "The latitude" }, "lon": { "type": "number", "description": "The longitude" } }, "required": [ "lat", "lon" ] } }, "required": [ "dir", "extract", "lang", "titles" ] }, "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": { "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" } } } } } } } }, "tags": [ { "name": "Math", "description": "formula rendering" } ], "securityDefinitions": { "mediawiki_auth": { "description": "Checks permissions using MW api", "type": "apiKey", "in": "header", "name": "cookie", "x-internal-request-whitelist": [ "/http:\\/\\/[a-zA-Z0-9\\.]+\\/w\\/api\\.php/" ] } }, "x-host-basePath": "/api/rest_v1", "x-default-params": {} }