Core Platform Team/Initiatives/Core REST API in MediaWiki/Schema

From MediaWiki.org
Jump to navigation Jump to search

"These are the data types and properties used in the Core REST API.

The schema assumes that all output is JSON, so JSON data types like object, array, string, number, boolean and null are all used.

Sizes[edit]

Each type has up to three sizes. These are subsets of the type that are required for different usage.

  • Small size is typically for references or links to an object. It should include enough information to uniquely identify the object, plus enough text to provide a human-readable link.
  • Medium size is the set of properties that most clients will need to work with the data type.
  • Large size is the full set of properties for the data type. This is typically what is returned from the main read endpoint for the data type.

Some properties are only available with certain endpoints; they don't have a stated size.

Types[edit]

Page
Property Description Data type Size
id Integer ID for the page number small
title Current title of the page, for display string small
key Current title of the page in prefixed-DB-key format string small
license license object for the main license for the page License object, small medium
other_licenses Array of license objects for alternative licenses the page is available under array of License, small medium
latest latest revision of the page, medium form Revision object, medium medium
content_model content model of the main slot of the page string medium
source Wikitext source for the main slot of the page string
html Parsoid HTML for the main page area (main slot plus any in-page rendered slots) string
slots Object mapping slot role to medium representation of Slot objects (see below) for non-main slots object, string -> Slot
thumbnail A FileRepresentation object (see below) for a small representation of the page. object, FileRepresentation
description A short (O(100) chars) description of the subject of the current page, if applicable, no markup string
Revision
Property Description Data type Size
id Integer ID for the revision number small
timestamp Save time of this revision, ISO 8601 YYYY-MM-DDTHH:MM:SSZ format string small
page Page this is a revision of Page object, small medium
user author of this revision User object, small medium
comment Edit comment (aka "summary") string medium
size Size in "bogobytes" (usually bytes of wikitext, but can be different for some content types) number medium
delta Change in size from previous revision, in bogobytes number medium
minor This is a "minor" edit, self-reported by the author (no fixed meaning, but usually spelling, grammar, or wikitext syntax changes) boolean medium
content_model Content model of the main slot of revision string medium
source Preferred source editing format (like wikitext or json) for the main slot of the revision string
html Parsoid HTML for the main page area of the revision (main slot plus any in-page rendered slots) string
slots Object mapping slot role to medium representation of Slot objects (see below) for non-main slots object, string -> Slot
api_url URL to the API endpoint for the revision string
tags Collection of Tag objects for the revision array of Tag objects (see below)
File
Property Description Data type Size
title Title of the file string small
latest latest revision of the file, FileRevision object, medium size FileRevision, medium medium
preferred preferred representation of the file, FileRepresentation object, medium size FileRepresentation, medium medium
license license object for the main license for the file License object, small medium
other_licenses Array of license objects for alternative licenses the page is available under array of License object, small medium
original original representation of the file as uploaded, FileRepresentation object, medium size FileRepresentation, medium large
modified automatically modified representations of the file; may differ by size or mediatype array of FileRepresentation, medium large
api_url URL to the API endpoint for the file string
FileRevision
Property Description Data type Size
timestamp Save time of this revision, ISO 8601 YYYY-MM-DDTHH:MM:SSZ format string medium
user author of this revision User object, small medium
FileRepresentation
Property Description Data type Size
mediatype Internet mediatype for the representation, like "image/png" or "audio/mp3" string medium
size size of the representation in bytes number medium
width width of the representation in pixels or null if not applicable number medium
height height of the representation in pixels or null if not applicable number medium
duration duration of the representation in seconds or null if not applicable number medium
url full URL to the contents of the file string medium
title title of the file this is a representation of; useful if the FileRepresentation isn't contained in a File string
User
Property Description Data type Size
id numeric ID of the user number small
name Name of a registered user or identifier for an "anonymous" one string small
Slot
Property Description Data type Size
id Slot ID integer small
content_model Content model of the slot string small
size Size of the slot in bogobytes integer small
source Source content for the slot, iif content model has a text source format (e.g. JSON, JS, CSS, SASS) string
html HTML representation of the slot, if that is meaningful for its content model and role string
data_url Source content for the slot, iif the content model has a binary source format string
revision Revision the slot was created for small Revision object
page Page the slot is part of small Page object
License
Property Description Data type Size
spdx SPDX code for the license, like "CC-BY-SA-3.0", if available string small
url URL for the license text, like "https://creativecommons.org/licenses/by-sa/3.0/" string small
title Title for the license, like " Creative Commons Attribution-ShareAlike License" string medium
Tag
Property Description Data type Size
name text of the tag string small
description HTML appearance for the tag string small