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=wbparsevalue

(main | wbparsevalue)
  • This module requires read rights.
  • Source: WikibaseClient
  • License: GPL-2.0-or-later

Parses values using a ValueParser.

Specific parameters:
Other general parameters are available.
datatype

Datatype of the value to parse. Determines the parser to use.

One of the following values: commonsMedia, edtf, entity-schema, external-id, geo-shape, globe-coordinate, localMedia, monolingualtext, quantity, string, tabular-data, time, url, wikibase-item, wikibase-property
property

Property ID the value to parse belongs to. Determines the parser to use.

parser
Deprecated.

ID of the ValueParser to use. Deprecated. Use the datatype parameter instead.

One of the following values: commonsMedia, edtf, entity-schema, external-id, geo-shape, globe-coordinate, globecoordinate, localMedia, monolingualtext, null, quantity, string, tabular-data, time, url, wikibase-entityid, wikibase-item, wikibase-property
values

The values to parse

This parameter is required.
Separate values with | or alternative.
Maximum number of values is 50 (500 for clients that are allowed higher limits).
options

The options the parser should use. Provided as a JSON object.

validate

Whether to additionally verify the data passed in.

Type: boolean (details)
Examples:
Parse a plain string into a StringValue object.
api.php?action=wbparsevalue&datatype=string&values=foo|bar [open in sandbox]
Parse 1994-02-08 to a TimeValue object with a precision of 9 (year).
api.php?action=wbparsevalue&datatype=time&values=1994-02-08&options={"precision":9} [open in sandbox]
Parse 1994-02-08 to a TimeValue object with a precision of 14 (second) with validation enabled, resulting in a validation failure.
api.php?action=wbparsevalue&datatype=time&validate&values=1994-02-08&options={"precision":14} [open in sandbox]
Parse foo into an object of whatever datatype P123 is, with validation enabled, potentially resulting in a validation failure depending on P123's datatype's expected input.
api.php?action=wbparsevalue&property=P123&validate&values=foo [open in sandbox]