User:APaskulin (WMF)/Sandbox/Reference

= Search =

Search result object
The search result object represents a wiki page matching the requested search.

Search pages
Searches wiki page titles and contents for the provided search terms, and returns matching pages. This endpoint responds to the presence of a logged-in user and returns search results appropriate to that user's permissions.

Autocomplete page title
Searches wiki page titles, and returns matches between the beginning of a title and the provided search terms. You can use this endpoint for a typeahead search that automatically suggests relevant pages by title. This endpoint responds to the presence of a logged-in user and returns search results appropriate to that user's permissions.

This endpoint uses the search engine configured in the $wgSearchType configuration setting and returns results in the namespaces configured by $wgNamespacesToBeSearchedDefault.

Results may differ depending on the configured search backend. While the default backend only applies basic case folding and prefix matches, more advanced backends may apply more complex variations. In the case of CirrusSearch for instance, matches are based on the Elastic Search completion suggester.

Responses
= Pages =

Create page
Creates a wiki page. This endpoint is designed to be used with the OAuth extension authorization process. Callers who instead use cookie-based authentication must add a CSRF  to the request body. See the Action API docs to learn how to retrieve a CSRF token.

 Request body schema 

 Responses 

Update page
Updates an existing wiki page. You can also use this endpoint to create a page by omitting the  property from the request body. This endpoint responds to the presence of a logged-in user and allows updates appropriate to that user's permissions.

When updating the page, the client should always first fetch the page content from the GET page source endpoint, modify the source, and copy the content of the  key. In the event of an edit conflict, this endpoint performs automatic conflict resolution if possible.

This endpoint is designed to be used with the OAuth extension authorization process. Callers who instead use cookie-based authentication must add a CSRF  to the request body. See the Action API docs to learn how to retrieve a CSRF token.

 Request examples 

 Request parameters 

 Request body schema 

 Responses 

Get page
Returns the standard Page object for a wiki page, including the API route to fetch the content of the page in HTML, the license, and information about the latest revision. This endpoint responds to the presence of a logged-in user and displays content appropriate to that user's permissions.

To use this endpoint on your wiki, install RESTBase and configure VirtualRESTService.

 Request examples 

 Request parameters 

 Responses 

Get page offline
Returns information about a wiki page, including the license, information about the latest revision, and the latest content of the page as HTML. See the HTML 2.1.0 spec for a description of the MediaWiki-specific semantic markup in this HTML. Note that additional metadata is available in the HTML head. This endpoint responds to the presence of a logged-in user and displays content appropriate to that user's permissions.

To use this endpoint on your wiki, install RESTBase and configure VirtualRESTService.

 Request examples 

 Request parameters 

 Responses 

Get page source
Returns the content of a wiki page in the format specified by the  property, the page license, and information about the latest revision. This endpoint responds to the presence of a logged-in user and displays content appropriate to that user's permissions.

 Request examples 

 Request parameters 

 Responses 

Get HTML
Returns the latest HTML for a wiki page. See the HTML 2.1.0 spec for a description of the MediaWiki-specific semantic markup in this HTML. Note that additional metadata is available in the HTML head. This endpoint responds to the presence of a logged-in user and displays content appropriate to that user's permissions.

To use this endpoint on your wiki, install RESTBase and configure VirtualRESTService.

 Request examples 

 Request parameters 

 Responses 

= Languages =

Get languages
Searches connected wikis for pages with the same topic in different languages. Returns an array of language objects that include the name of the language, the language code, and the translated page title. This endpoint responds to the presence of a logged-in user and displays content appropriate to that user's permissions.

 Request examples 

 Request parameters 

 Responses 

= Media files =

Get file
Returns information about a file, including links to download the file in thumbnail, preview, and original formats. This endpoint responds to the presence of a logged-in user and displays content appropriate to that user's permissions.

Get media files
Returns information about media files used on a wiki page. This endpoint responds to the presence of a logged-in user and displays content appropriate to that user's permissions.

 Request examples 

 Request parameters 

 Responses 

= History =

Revision object
required required required required required required required required
 * integer
 * The revision ID
 * object
 * The  and   of the page
 * object
 * The  and   of the account that made the edit. For anonymous users, the   contains the originating IP address, and the   is.
 * string
 * The time of the edit in ISO 8601 format. (Example: )
 * string
 * A comment or edit summary written by the editor. For revisions without a comment, the API can return  or.
 * integer
 * The size of the edit in bytes.
 * integer
 * The change, positive or negative, in bytes between a revision and the preceding revision. If the preceding revision is unavailable, the API returns . (Example:  )
 * boolean
 * Set to true for edits marked as minor.
 * }

Get page history
Returns information about the 20 latest revisions to a wiki page, starting with the latest revision. The returned revision segment includes API routes for the next oldest, next newest, and latest revisions, letting you scroll through page history. This endpoint responds to the presence of a logged-in user and displays content appropriate to that user's permissions.

 Request examples 

 Request parameters 

 Responses 

 Response schema 

Get page history counts
Returns data about a page's history.

 Request examples 

 Request parameters 

 Responses 

 Response schema 

Get revision
Returns details for an individual revision. This endpoint responds to the presence of a logged-in user and displays content appropriate to that user's permissions.

 Request example 

 Request parameters 

 Responses 

Compare revisions
Returns data that lets you display a line-by-line comparison of two revisions. (See an example.) Only text-based wiki pages can be compared; trying to compare revisions of other page types, such as image pages, results in a 400 response code. This endpoint responds to the presence of a logged-in user and displays content appropriate to that user's permissions.

The compare revisions endpoint requires Wikidiff2 1.9.0 or later.

 Request example 

 Request parameters 

 Responses 

 Response schema