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=wbformatvalue
(main | wbformatvalue)
- This module requires read rights.
- Source: WikibaseClient
- License: GPL-2.0-or-later
Formats DataValues.
Specific parameters:
Other general parameters are available.
- generate
The desired output format to generate.
- One of the following values: text/html, text/html; disposition=verbose, text/html; disposition=verbose-preview, text/plain, text/x-wiki
- Default: text/x-wiki
- datavalue
The data to format. This has to be the JSON serialization of a DataValue object.
- This parameter is required.
- datatype
The value's data type. This is distinct from the value's type
- One of the following values: commonsMedia, external-id, geo-shape, globe-coordinate, monolingualtext, quantity, string, tabular-data, time, url, wikibase-item, wikibase-property
- property
Property ID the data value belongs to, should be used instead of the datatype parameter.
- options
The options the formatter should use. Provided as a JSON object.
Examples:
- Format a simple string value.
- api.php?action=wbformatvalue&datavalue=%7B%22value%22%3A%22hello%22%2C%22type%22%3A%22string%22%7D [open in sandbox]
- Format a string value as a URL in HTML.
- api.php?action=wbformatvalue&datavalue=%7B%22value%22%3A%22http%3A%5C%2F%5C%2Facme.org%22%2C%22type%22%3A%22string%22%7D&datatype=url&generate=text%2Fhtml [open in sandbox]
- Format a time value as plain text, automatically showing the calendar model if needed.
- api.php?action=wbformatvalue&datavalue=%7B%22value%22%3A%7B%22time%22%3A%22%2B1879-03-14T00%3A00%3A00Z%22%2C%22timezone%22%3A0%2C%22before%22%3A0%2C%22after%22%3A0%2C%22precision%22%3A11%2C%22calendarmodel%22%3A%22http%3A%5C%2F%5C%2Fwww.wikidata.org%5C%2Fentity%5C%2FQ1985727%22%7D%2C%22type%22%3A%22time%22%7D&datatype=time&generate=text%2Fplain&options=%7B%22showcalendar%22%3A%22auto%22%7D [open in sandbox]