Skip to content
ValterVB edited this page Jan 4, 2015 · 1 revision

This is the class to manage all the API request.

Constructor

WikimediaAPI(string Site, string User, string Password)

Example
WikimediaAPI WD = new WikimediaAPI("https://www.wikidata.org", "User", "Password");

Load

string LoadWD(string Entities, LoadTypeWD Type = LoadTypeWD.All)

  • Entities String with entity id separated by | (ex. Q45|P38|Q60)
  • Type What retrieve (ex. only label or description or all
  • return JSON string of entities
This function use API wbgetentities&format=json&redirects=yes.

string LoadWD(string Site, string Pages, LoadTypeWD Type = LoadTypeWD.All)

  • Site Wikimedia site (ex. itwiki or itwikiquote)
  • Pages String with page title separated by | (ex. London|Berlin)
  • Type What retrieve (ex. only label or description or all)
  • return JSON string of entities
This function use API wbgetentities&format=json&redirects=yes.

string LoadWP(string Pages)

  • PagesString with page title separated by | (ex. London|Berlin)
  • return JSON string of the pages.
This function use API wbgetentities&format=json&redirects=yes.

Edit

string EditEntity(string id, Dictionary<string, string> links, Dictionary<string, string> labels, Dictionary<string, string> descriptions, Dictionary<string, List<string>> aliases, List<Claim> claims, string summary)

  • id entity id (ex. Q564), empty string to create a new entity.
  • links Dictionary with sitelinks
  • labels Dictionary with labels
  • descriptions Dictionary with descriptions
  • aliases Dictionary with aliases
  • claims List of claims
  • summary Comment of the edit, empty string to auto description
This function use API wbeditentity.

string SetBadge(string Item, string Sitelink, string Badge)

  • Itementity id (ex. Q564)
  • SitelinkSitelink where to add the badge (ex. itwiki)
  • BadgeItem of the badge, empty string to delete badge
This function use API wbsetsitelink.

string SavePage(string Page, string Text, string Summary)

  • PageTitle of the page
  • Textext to be saved
  • Summary Comment of the edit
This function use API edit. Creates a new page if doesn't exist.

Clone this wiki locally