User:User:Dikshagupta99/Sandbox/API:Get the contents of a page

There are basically three main methods for retrieving page contents via the API:


 * 1) Get data about the set of pages by setting titles or page ids(for retrieving wikitext)
 * 2) Specify content explicitely using text, title, revid and content model(for retrieving parsed content)
 * 3) Return plain text or limited HTML extracts of a given page.

Method 1: Get revised page data from API:Revisions
There are several ways of getting the revised data:


 * 1) Get data about a set of pages (last revision), by setting titles or pageids.
 * 2) Get revisions for one given page, by using titles or pageids with start, end, or limit.
 * 3) Get data about a set of revisions by setting their IDs with revids.

Example
The below GET Request is to obtain revision data of pages with titles and

Method 2: Get the content of a page by API:Parsing_wikitext
There are several ways to specify the text to parse:


 * 1) Specify a page or revision, using page, pageid, or oldid.
 * 2) Specify content explicitly, using text, title, revid, and contentmodel.
 * 3) Specify only a summary to parse. prop should be given an empty value.

For more details regarding API:Parsing_wikitext view

Example
Here is an example of getting a parsed content:

Method 3: Get the content of the page using Extension:TextExtracts#API
The TextExtracts extension provides an API which allows to retrieve plain-text or limited HTML (HTML with content for [https://github.com/wikimedia/mediawiki-extensions-TextExtracts/blob/master/extension.json#L38 some CSS classes] removed) extracts of page content.

Example
Get a 175-character extract:

Download Extension
To download extension view-