Wikidata/Notes/API

This is an archived version of this page, as edited by Jeroen De Dauw (talk | contribs) at 09:50, 18 April 2012. It may differ significantly from the current version.

The Wikidata API will simply be an extension of the existing MediaWiki API.

The following functions are being envisioned for Phase 1 (or even Phase 0.5, which is, for Wikimania. * means optional):

  • getData(id, *language) - returns the data for a given ID. This is used by the Wikidata client extension. The language is set in order to add labels to the IDs. (ApiWikibaseGetItem, name & param confusion)
  • getIdByWikipedia(language, title) - returns the ID of the page in Wikidata that corresponds to a Wikipedia article with the given title.
  • getDataByWikipedia(language, title, *language) - This is used in order to give the data for a given Wikipedia article, based on the articles titles instead of the ID (it is basically a concatenation of getIdByWikipedia + getData). This allows the clients not to know about their corresponding IDs. The result is the same as for getData. (ApiWikibaseGetItemId, name & param confusion)
  • linkSite( ( id XOR ( site, title ) ), linksite, linktitle *badge) (ApiWikibaseSiteLink)
  • linkWikipedias(language-from, title-from, language-to, title-to) (optional?) (basically a shortcut for getIdByWikipedia + setLanguageLink) (ApiWikibaseLinkArticles)
  • setLabel(id, language, label) (ApiWikibaseSetLabel)
  • setDescription(id, language, description) (ApiWikibaseSetDescription)
  • addAlias(id, language, alias) (ApiWikibaseAddAlias)
  • removeAlias(id, language, alias) (ApiWikibaseRemoveAlias)
  • searchByName(language, fragment, *hints) (used for the Wikidata Suggest widget)

Note, that the names need to be aligned with the existing naming policy.