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

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


 * 1) Get data about the set of pages by setting titles or page ids(for retrieving wikitext).
 * 2) Specify content explicitly using text, title, revision id(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 page ids.
 * 2) Get revisions for one given page, by using titles or page ids with start, end, or limit.
 * 3) Get data about a set of revisions by setting their IDs with revision ids.

Example
GET request to obtain revised data of the page Pet door.

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, page id, or old id.
 * 2) Specify content explicitly, using text, title, revision id, and content model.
 * 3) Specify only a summary to parse. property(prop) should be given an empty value.

Example
GET request to get parsed content of a page: Pet door.

Response
 ^ "World's first Passive House-certified pet door unveiled at Ecobuild 2014". www.gizmag.com. Retrieved 2016-07-07.  .mw-parser-output cite.citation{font-style:inherit}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation .cs1-lock-free a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/6/65/Lock-green.svg/9px-Lock-green.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output .citation .cs1-lock-limited a,.mw-parser-output .citation .cs1-lock-registration a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/d/d6/Lock-gray-alt-2.svg/9px-Lock-gray-alt-2.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output .citation .cs1-lock-subscription a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Lock-red-alt-2.svg/9px-Lock-red-alt-2.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output .cs1-subscription,.mw-parser-output .cs1-registration{color:#555}.mw-parser-output .cs1-subscription span,.mw-parser-output .cs1-registration span{border-bottom:1px dotted;cursor:help}.mw-parser-output .cs1-ws-icon a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/4/4c/Wikisource-logo.svg/12px-Wikisource-logo.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output code.cs1-code{color:inherit;background:inherit;border:inherit;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;font-size:100%}.mw-parser-output .cs1-visible-error{font-size:100%}.mw-parser-output .cs1-maint{display:none;color:#33aa33;margin-left:0.3em}.mw-parser-output .cs1-subscription,.mw-parser-output .cs1-registration,.mw-parser-output .cs1-format{font-size:95%}.mw-parser-output .cs1-kern-left,.mw-parser-output .cs1-kern-wl-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right,.mw-parser-output .cs1-kern-wl-right{padding-right:0.2em}   ^ "Automated Pet Doors&#160;: pet door". Retrieved 2016-07-07.   </li>  <a href="#cite_ref-3">^</a> <cite class="citation web"><a rel="nofollow" class="external text" href="http://www.ubergizmo.com/2014/03/petwalk-automatic-pet-door-prevents-wet-paw-marks-around-the-home/">"PetWALK Automatic Pet Door Prevents Wet Paw Marks Around The Home"</a>. Ubergizmo. 2014-03-13 . Retrieved 2016-07-07. <span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=Ubergizmo&amp;rft.atitle=PetWALK+Automatic+Pet+Door+Prevents+Wet+Paw+Marks+Around+The+Home&amp;rft.date=2014-03-13&amp;rft_id=http%3A%2F%2Fwww.ubergizmo.com%2F2014%2F03%2Fpetwalk-automatic-pet-door-prevents-wet-paw-marks-around-the-home%2F&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3APet+door" class="Z3988">  </li>  <a href="#cite_ref-4">^</a> Oxford English Dictionary (full ed.), 2005. </li>  <a href="#cite_ref-NatGeo_2004_5-0">^</a> <cite class="citation web"><a rel="nofollow" class="external text" href="http://news.nationalgeographic.com/news/2004/04/0408_040408_oldestpetcat.html">"Oldest Known Pet Cat? 9500-year-old Burial Found on Cyprus"</a>. National Geographic News. National Geographic Society. April 8, 2004. Retrieved March 6, 2007. <span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=National+Geographic+News&amp;rft.atitle=Oldest+Known+Pet+Cat%3F+9500-year-old+Burial+Found+on+Cyprus&amp;rft.date=2004-04-08&amp;rft_id=http%3A%2F%2Fnews.nationalgeographic.com%2Fnews%2F2004%2F04%2F0408_040408_oldestpetcat.html&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3APet+door" class="Z3988">  </li>  <a href="#cite_ref-6">^</a> <cite class="citation web">Anonymous ("The Country Parson") (1863). E. H. Sears &amp; Rufus Ellis (ed.). <a rel="nofollow" class="external text" href="https://books.google.com/books?id=PXYUAAAAYAAJ&amp;pg=PA298">"Random Readings: Philosophy and Common Sense"</a>. The Monthly Religious Magazine. Boston, MA: Leonard C. Bowles Press. p.&#160;298. <span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=The+Monthly+Religious+Magazine&amp;rft.atitle=Random+Readings%3A+Philosophy+and+Common+Sense&amp;rft.pages=298&amp;rft.date=1863&amp;rft.au=Anonymous+%28%22The+Country+Parson%22%29&amp;rft_id=https%3A%2F%2Fbooks.google.com%2Fbooks%3Fid%3DPXYUAAAAYAAJ%26pg%3DPA298&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3APet+door" class="Z3988">  </li>  <a href="#cite_ref-7">^</a> Brodetsky, S. (2007) [first pub. 1927]. Sir Isaac Newton. Upton Press. p. 100. <a href="/wiki/International_Standard_Book_Number" title="International Standard Book Number">ISBN</a>&#160;<a href="/wiki/Special:BookSources/1406769991" title="Special:BookSources/1406769991">1406769991</a>. </li>  <a href="#cite_ref-8">^</a> More, Louis Trenchard (1937). Isaac Newton: a Biography. C. Scribner's Sons. </li>  <a href="#cite_ref-9">^</a> Wright, J. F. M. (1827). Alma Mater. Volume 1. p. 17. </li>  <a href="#cite_ref-10">^</a> <cite class="citation web"><a rel="nofollow" class="external text" href="http://www.petplan.co.uk/petcensus/censusinfo.pdf">"Petplan Pet Census 2011"</a> (PDF). Petplan. p.&#160;15. Retrieved September 11, 2012. <span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=Petplan+Pet+Census+2011&amp;rft.pages=15&amp;rft.pub=Petplan&amp;rft_id=http%3A%2F%2Fwww.petplan.co.uk%2Fpetcensus%2Fcensusinfo.pdf&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3APet+door" class="Z3988">  </li>  <a href="#cite_ref-11">^</a> <cite class="citation web">Woods, Amanda. <a rel="nofollow" class="external text" href="https://medium.com/@woodsamanda399/7-important-measures-to-pet-proof-your-home-bdd3e33ae4c8">"7 Important Measures to Pet Proof Your Home"</a>. Retrieved 23 August 2017. <span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=7+Important+Measures+to+Pet+Proof+Your+Home&amp;rft.aulast=Woods&amp;rft.aufirst=Amanda&amp;rft_id=https%3A%2F%2Fmedium.com%2F%40woodsamanda399%2F7-important-measures-to-pet-proof-your-home-bdd3e33ae4c8&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3APet+door" class="Z3988">  </li> </ol>

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 extracts of page content.

Example
Get request to extract 10 sentences from the page: Pet door