MediaWiki API help

This is an auto-generated MediaWiki API documentation page.

Documentation and examples: https://www.mediawiki.org/wiki/Special:MyLanguage/API:Main_page

(main | wbsetsitelink)
  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.
  • Source: WikibaseClient
  • License: GPL-2.0-or-later

Associates a page on a wiki with a Wikibase item or removes an already made such association.

Specific parameters:
Other general parameters are available.
id

The identifier for the entity, including the prefix. Use either id or site and title together.

new

If set, a new entity will be created. Set this to the type of the entity you want to create.

One of the following values: item, property
site

An identifier for the site on which the page resides. Use together with title to make a complete sitelink.

One of the following values: aawiki, abwiki, acewiki, adywiki, afwiki, akwiki, alswiki, amwiki, angwiki, anwiki, arcwiki, arwiki, arzwiki, astwiki, aswiki, atjwiki, avwiki, aywiki, azbwiki, azwiki, banwiki, barwiki, bat_smgwiki, bawiki, bclwiki, be_x_oldwiki, bewiki, bgwiki, bhwiki, biwiki, bjnwiki, bmwiki, bnwiki, bowiki, bpywiki, brwiki, bswiki, bugwiki, bxrwiki, cawiki, cbk_zamwiki, cdowiki, cebwiki, cewiki, chowiki, chrwiki, chwiki, chywiki, ckbwiki, commonswiki, cowiki, crhwiki, crwiki, csbwiki, cswiki, cuwiki, cvwiki, cywiki, datatrek, dawiki, dema, demb, dewiki, dinwiki, diqwiki, dsbwiki, dtywiki, dvwiki, dzwiki, eewiki, elwiki, emlwiki, enma, enmb, enwiki, eowiki, eswiki, etwiki, euwiki, extwiki, fanlore, fawiki, ffwiki, fiu_vrowiki, fiwiki, fjwiki, fowiki, frpwiki, frrwiki, frwiki, furwiki, fywiki, gagwiki, ganwiki, gawiki, gcrwiki, gdwiki, glkwiki, glwiki, gnwiki, gomwiki, gorwiki, gotwiki, guwiki, gvwiki, hakwiki, hawiki, hawwiki, hewiki, hifwiki, hiwiki, howiki, hrwiki, hsbwiki, htwiki, huwiki, hywiki, hywwiki, hzwiki, iawiki, idwiki, iewiki, igwiki, iiwiki, ikwiki, ilowiki, inhwiki, iowiki, iswiki, itma, itwiki, iuwiki, jamwiki, jawiki, jbowiki, jvwiki, kaawiki, kabwiki, kawiki, kbdwiki, kbpwiki, kgwiki, kiwiki, kjwiki, kkwiki, klwiki, kmwiki, knwiki, koiwiki, kowiki, krcwiki, krwiki, kshwiki, kswiki, kuwiki, kvwiki, kwwiki, kywiki, ladwiki, lawiki, lbewiki, lbwiki, lezwiki, lfnwiki, lgwiki, lijwiki, liwiki, lmowiki, lnwiki, lowiki, lrcwiki, ltgwiki, ltwiki, lvwiki, maiwiki, map_bmswiki, mdfwiki, mgwiki, mhrwiki, mhwiki, minwiki, miwiki, mkwiki, mlwiki, mnwiki, mnwwiki, mrjwiki, mrwiki, mswiki, mtwiki, muswiki, mwlwiki, myvwiki, mywiki, mznwiki, nahwiki, napwiki, nawiki, nds_nlwiki, ndswiki, newiki, newwiki, ngwiki, nlwiki, nnwiki, novwiki, nowiki, nqowiki, nrmwiki, nsowiki, nvwiki, nywiki, ocwiki, olowiki, omwiki, orwiki, oswiki, pagwiki, pamwiki, papwiki, pawiki, pcdwiki, pdcwiki, pflwiki, pihwiki, piwiki, plwiki, pmswiki, pnbwiki, pntwiki, pswiki, ptwiki, quwiki, rmwiki, rmywiki, rnwiki, roa_rupwiki, roa_tarawiki, rowiki, ruewiki, ruwiki, rwwiki, sahwiki, satwiki, sawiki, scnwiki, scowiki, scwiki, sdwiki, sewiki, sgwiki, shnwiki, shwiki, simplewiki, siwiki, skwiki, slwiki, smwiki, snwiki, sowiki, sqwiki, srnwiki, srwiki, sswiki, sto, stqwiki, stwiki, suwiki, svwiki, swwiki, szlwiki, szywiki, tawiki, tcywiki, tetwiki, tewiki, tgwiki, thwiki, tiwiki, tkwiki, tlwiki, tnwiki, towiki, tpiwiki, trekipedia, trwiki, tswiki, ttwiki, tumwiki, twwiki, tyvwiki, tywiki, udmwiki, ugwiki, ukwiki, urwiki, uzwiki, vecwiki, vepwiki, vewiki, viwiki, vlswiki, vowiki, warwiki, wawiki, wikidata, wikidatawiki, wikitrek, wowiki, wuuwiki, xalwiki, xhwiki, xmfwiki, yiwiki, yowiki, zawiki, zeawiki, zh_classicalwiki, zh_min_nanwiki, zh_yuewiki, zhwiki, zuwiki
title

Title of the page to associate. Use together with site to make a complete sitelink.

baserevid

The numeric identifier for the revision to base the modification on. This is used for detecting conflicts during save.

Type: integer
summary

Summary for the edit. Will be prepended by an automatically generated comment. The length limit of the autocomment together with the summary is 260 characters. Be aware that everything above that limit will be cut off.

tags

Change tags to apply to the revision.

Values (separate with | or alternative):
token

A "csrf" token retrieved from action=query&meta=tokens

This parameter is required.
bot

Mark this edit as bot. This URL flag will only be respected if the user belongs to the group "bot".

Type: boolean (details)
linksite

The identifier of the site on which the page to link resides

This parameter is required.
One of the following values: aawiki, abwiki, acewiki, adywiki, afwiki, akwiki, alswiki, amwiki, angwiki, anwiki, arcwiki, arwiki, arzwiki, astwiki, aswiki, atjwiki, avwiki, aywiki, azbwiki, azwiki, banwiki, barwiki, bat_smgwiki, bawiki, bclwiki, be_x_oldwiki, bewiki, bgwiki, bhwiki, biwiki, bjnwiki, bmwiki, bnwiki, bowiki, bpywiki, brwiki, bswiki, bugwiki, bxrwiki, cawiki, cbk_zamwiki, cdowiki, cebwiki, cewiki, chowiki, chrwiki, chwiki, chywiki, ckbwiki, commonswiki, cowiki, crhwiki, crwiki, csbwiki, cswiki, cuwiki, cvwiki, cywiki, datatrek, dawiki, dema, demb, dewiki, dinwiki, diqwiki, dsbwiki, dtywiki, dvwiki, dzwiki, eewiki, elwiki, emlwiki, enma, enmb, enwiki, eowiki, eswiki, etwiki, euwiki, extwiki, fanlore, fawiki, ffwiki, fiu_vrowiki, fiwiki, fjwiki, fowiki, frpwiki, frrwiki, frwiki, furwiki, fywiki, gagwiki, ganwiki, gawiki, gcrwiki, gdwiki, glkwiki, glwiki, gnwiki, gomwiki, gorwiki, gotwiki, guwiki, gvwiki, hakwiki, hawiki, hawwiki, hewiki, hifwiki, hiwiki, howiki, hrwiki, hsbwiki, htwiki, huwiki, hywiki, hywwiki, hzwiki, iawiki, idwiki, iewiki, igwiki, iiwiki, ikwiki, ilowiki, inhwiki, iowiki, iswiki, itma, itwiki, iuwiki, jamwiki, jawiki, jbowiki, jvwiki, kaawiki, kabwiki, kawiki, kbdwiki, kbpwiki, kgwiki, kiwiki, kjwiki, kkwiki, klwiki, kmwiki, knwiki, koiwiki, kowiki, krcwiki, krwiki, kshwiki, kswiki, kuwiki, kvwiki, kwwiki, kywiki, ladwiki, lawiki, lbewiki, lbwiki, lezwiki, lfnwiki, lgwiki, lijwiki, liwiki, lmowiki, lnwiki, lowiki, lrcwiki, ltgwiki, ltwiki, lvwiki, maiwiki, map_bmswiki, mdfwiki, mgwiki, mhrwiki, mhwiki, minwiki, miwiki, mkwiki, mlwiki, mnwiki, mnwwiki, mrjwiki, mrwiki, mswiki, mtwiki, muswiki, mwlwiki, myvwiki, mywiki, mznwiki, nahwiki, napwiki, nawiki, nds_nlwiki, ndswiki, newiki, newwiki, ngwiki, nlwiki, nnwiki, novwiki, nowiki, nqowiki, nrmwiki, nsowiki, nvwiki, nywiki, ocwiki, olowiki, omwiki, orwiki, oswiki, pagwiki, pamwiki, papwiki, pawiki, pcdwiki, pdcwiki, pflwiki, pihwiki, piwiki, plwiki, pmswiki, pnbwiki, pntwiki, pswiki, ptwiki, quwiki, rmwiki, rmywiki, rnwiki, roa_rupwiki, roa_tarawiki, rowiki, ruewiki, ruwiki, rwwiki, sahwiki, satwiki, sawiki, scnwiki, scowiki, scwiki, sdwiki, sewiki, sgwiki, shnwiki, shwiki, simplewiki, siwiki, skwiki, slwiki, smwiki, snwiki, sowiki, sqwiki, srnwiki, srwiki, sswiki, sto, stqwiki, stwiki, suwiki, svwiki, swwiki, szlwiki, szywiki, tawiki, tcywiki, tetwiki, tewiki, tgwiki, thwiki, tiwiki, tkwiki, tlwiki, tnwiki, towiki, tpiwiki, trekipedia, trwiki, tswiki, ttwiki, tumwiki, twwiki, tyvwiki, tywiki, udmwiki, ugwiki, ukwiki, urwiki, uzwiki, vecwiki, vepwiki, vewiki, viwiki, vlswiki, vowiki, warwiki, wawiki, wikidata, wikidatawiki, wikitrek, wowiki, wuuwiki, xalwiki, xhwiki, xmfwiki, yiwiki, yowiki, zawiki, zeawiki, zh_classicalwiki, zh_min_nanwiki, zh_yuewiki, zhwiki, zuwiki
linktitle

The title of the page to link. If this parameter is an empty string or both linktitle and badges are not set, the link will be removed.

badges

The IDs of items to be set as badges. They will replace the current ones. If this parameter is not set, the badges will not be changed

Values (separate with | or alternative): Q12028
Examples:
Add a sitelink to the English page "Hydrogen" to the item with ID Q999999998, if the sitelink does not exist
api.php?action=wbsetsitelink&id=Q999999998&linksite=enwiki&linktitle=Hydrogen [open in sandbox]
Add a sitelink to the English page "Hydrogen" to the item with ID Q999999998, if the sitelink does not exist. Also appends "Loves Oxygen" to the edit summary.
api.php?action=wbsetsitelink&id=Q999999998&linksite=enwiki&linktitle=Hydrogen&summary=Loves%20Oxygen [open in sandbox]
Add a sitelink to the German page "Wasserstoff" to the item that is linked with the English page "Hydrogen", if the sitelink does not exist
api.php?action=wbsetsitelink&site=enwiki&title=Hydrogen&linksite=dewiki&linktitle=Wasserstoff [open in sandbox]
Remove the German sitelink from the item
api.php?action=wbsetsitelink&site=enwiki&title=Hydrogen&linksite=dewiki [open in sandbox]
Add a sitelink to the Polish page "Wodór" to the item that is linked with the English page "Hydrogen", with one badge pointing to the item with ID "Q149"
api.php?action=wbsetsitelink&site=enwiki&title=Hydrogen&linksite=plwiki&linktitle=Wodór&badges=Q149 [open in sandbox]
Change badges for the link to the Polish page from the item with ID Q999999998 to two badges pointing to the items with IDs "Q2" and "Q149" without providing the link title
api.php?action=wbsetsitelink&id=Q999999998&linksite=plwiki&badges=Q2|Q149 [open in sandbox]
Change the link to the Polish page from the item with ID Q999999998 without changing badges
api.php?action=wbsetsitelink&id=Q999999998&linksite=plwiki&linktitle=Warszawa [open in sandbox]
Change the link to the Polish page from the item with ID Q999999998 and remove all of its badges
api.php?action=wbsetsitelink&id=Q999999998&linksite=plwiki&linktitle=Wodór&badges= [open in sandbox]