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
action=wbsetreference
- This module requires read rights.
- This module requires write rights.
- This module only accepts POST requests.
- Source: WikibaseRepository
- License: GPL-2.0-or-later
Creates a reference or sets the value of an existing one.
- statement
A GUID identifying the statement for which a reference is being set
- This parameter is required.
- snaks
The snaks to set the reference to. JSON object with property IDs pointing to arrays containing the snaks for that property
- This parameter is required.
- snaks-order
The order of the snaks. JSON array of property ID strings
- reference
A hash of the reference that should be updated. Optional. When not provided, a new reference is created
- index
The index within the statement's list of references where to move the reference to. Optional. When not provided, an existing reference will stay in place while a new reference will be appended.
- 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.
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.
- baserevid
The numeric identifier for the revision to base the modification on. This is used for detecting conflicts during save.
- Type: integer
- bot
Mark this edit as bot. This URL flag will only be respected if the user belongs to the group "bot".
- Type: boolean (details)
- returnto
Page title. If saving the edit created a temporary account, the API may respond with an URL that the client should visit to complete logging in. If this parameter is provided, the URL will redirect to the given page, instead of the page that was edited.
- Type: page title
- Accepts non-existent pages.
- returntoquery
URL query parameters (with leading ?). If saving the edit created a temporary account, the API may respond with an URL that the client should visit to complete logging in. If this parameter is provided, the URL will redirect to a page with the given query parameters.
- Default: (empty)
- returntoanchor
URL fragment (with leading #). If saving the edit created a temporary account, the API may respond with an URL that the client should visit to complete logging in. If this parameter is provided, the URL will redirect to a page with the given fragment.
- Default: (empty)
- Create a new reference for claim with GUID Q999999998$D4FDE516-F20C-4154-ADCE-7C5B609DFDFF
- api.php?action=wbsetreference&statement=Q999999998$D4FDE516-F20C-4154-ADCE-7C5B609DFDFF&snaks={"P212":[{"snaktype":"value","property":"P212","datavalue":{"type":"string","value":"foo"}}]}&baserevid=7201010&token=foobar [open in sandbox]
- Set reference for claim with GUID Q999999998$D4FDE516-F20C-4154-ADCE-7C5B609DFDFF which has hash of 1eb8793c002b1d9820c833d234a1b54c8e94187e
- api.php?action=wbsetreference&statement=Q999999998$D4FDE516-F20C-4154-ADCE-7C5B609DFDFF&reference=1eb8793c002b1d9820c833d234a1b54c8e94187e&snaks={"P212":[{"snaktype":"value","property":"P212","datavalue":{"type":"string","value":"bar"}}]}&baserevid=7201010&token=foobar [open in sandbox]
- Creates a new reference for the claim with GUID Q999999998$D4FDE516-F20C-4154-ADCE-7C5B609DFDFF and inserts the new reference at the top of the list of references instead of appending it to the bottom.
- api.php?action=wbsetreference&statement=Q999999998$D4FDE516-F20C-4154-ADCE-7C5B609DFDFF&snaks={"P212":[{"snaktype":"novalue","property":"P212"}]}&index=0&baserevid=7201010&token=foobar [open in sandbox]