API:Information in Wikimedia projects

From mediawiki.org

Wikimedia's free open knowledge is available on web sites that anyone can edit, all running MediaWiki software. You're probably familiar with Wikipedia, the project to build free encyclopedias in all languages of the world, but the information available is even broader.

Wikipedia and beyond[edit]

The "Wikipedia" in a particular language, such as https://my.wikipedia.org in Burmese, hosts information on thousands to millions of subjects.

The unit of information on a wiki is a page, for example https://my.wikipedia.org/wiki/ပါရီမြို့ is a wiki page that is the article about "Paris" in the Burmese language.

Other wikis[edit]

The Wikimedia Foundation supports many other collections of free open knowledge, here are some of them. See Our projects on the Wikimedia Foundation site for a complete list.

Wiki families[edit]

wiki family Description Example English page
Wiktionary dictionary https://en.wiktionary.org/wiki/Paris is a page in English that defines various meanings of "Paris" in English and other languages
Wikisource free library of texts https://en.wikisource.org/wiki/Page:Queen_Mab_%28Shelley%29.djvu/9 is a scanned page of a book and its text
Wikivoyage travel guide https://en.wikivoyage.org/wiki/Paris
Wikiquote collection of quotations https://en.wikiquote.org/wiki/Paris has quotations about Paris in English

There are two important wikis that hold language-independent information, and thus are a single wiki (rather than a family of wikis in different languages):

Commons hosts millions of freely usable images and other media files[edit]


For example, https://commons.wikimedia.org/wiki/File:Paris_Night.jpg has information about an image of Paris at night, including the URL of the image itself (as of August 2015 at https://upload.wikimedia.org/wikipedia/commons/e/e6/Paris_Night.jpg).

A wiki editor in turn cropped this image to form Paris_banner.jpg, the banner at the top of the Wikivoyage article on Paris.

Wikidata is a knowledgebase of millions of data items[edit]

For example, https://www.wikidata.org/wiki/Q90 is the Wikidata page of the item with information about the City of Paris: its coat of arms, country, motto, population, etc. The same information can display in other languages, for example https://www.wikidata.org/wiki/Q90?uselang=pt is the page in Portuguese.

Wikidata also stores structured data relevant to its Wikimedia sister projects, such as

  • "sitelinks" that connect the item to corresponding articles on other wikis, including the examples above on this page
  • the "Wikivoyage banner" for the item that displays at the top of the Wikivoyage articles about Paris in different languages.

Accessing information[edit]

You can simply link to pages in these wikis. You can also access the information on a page. To do so you use the same APIs to access all this content:

  • Display article HTML in your own application using a fast caching API called RESTBase.
  • Get information about articles using the MediaWiki "action=query" API, as explained in Page info in search results, and display these snippets of information.