MediaWiki API help
This is an auto-generated MediaWiki API documentation page.
Documentation and examples: https://www.mediawiki.org/wiki/API
action=wbparsevalue
(main | wbparsevalue)
- This module requires read rights.
- Source: WikibaseClient
- License: GPL-2.0-or-later
Parses values using a ValueParser
.
Parameters:
- datatype
Datatype of the value to parse. Determines the parser to use.
- One of the following values: commonsMedia, geo-shape, globe-coordinate, monolingualtext, quantity, string, tabular-data, entity-schema, time, url, external-id, wikibase-item, wikibase-property
- parser
- Deprecated.
ID of the
ValueParser
to use. Deprecated. Use the datatype parameter instead.- One of the following values: wikibase-entityid, globecoordinate, null, commonsMedia, geo-shape, globe-coordinate, monolingualtext, quantity, string, tabular-data, entity-schema, time, url, external-id, 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 bots).
- 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]