Tarrow added a comment. |
I've tested various combinations of the possible entries in the "datavalue" parameter. i.e. varying the specified type and the id string datavalue=={"type":"$TYPE", "value": {"id":"$VALUE"}} while keeping the "datatype" parameter fixed as wikibase-item
with the following possible values:
TYPES="bad globecoordinate monolingualtext quantity string url commonsMedia geo-shape tabular-data time wikibase-entityid wikibase-unmapped-entityid external-id wikibase-lexeme wikibase-form wikibase-sense wikibase-item wikibase-property"
VALUES="L10-F3 L10-S3 L10 P10 Q100"
Every combination except $TYPE == wikibase-entityid resulted in a internal_api_error_InvalidArgumentException
which resulted in the following:
Trying value: L10-F3 and type: wikibase-entityid {"result":"<a title=\"Lexeme:L10\" href="" Trying value: L10-S3 and type: wikibase-entityid {"result":"<a title=\"Lexeme:L10\" href="" Trying value: L10 and type: wikibase-entityid {"result":"<a title=\"Lexeme:L10\" href="" Trying value: P10 and type: wikibase-entityid {"result":"<a title=\"Property:P10\" href="" Trying value: Q100 and type: wikibase-entityid {"result":"<a title=\"Q100\" href="">
Totally omitting the type field in the json results in: DataValue type is missing errors.
If we now fix "type" in the datavalue JSON blob to wikibase-entityid and instead vary the type in the "datatype" url parameter we see the following results.
Setting the datatype parameter to wikibase-item or wikibase-property generally results in sensible response no matter whether or not the provided id actually is a property or item id however the text of the link is only "human readable" for properties and items.
See the following:
Trying value: L10-F3 and type: wikibase-item {"result":"<a title=\"Lexeme:L10\" href="" Trying value: L10-S3 and type: wikibase-item {"result":"<a title=\"Lexeme:L10\" href="" Trying value: L10 and type: wikibase-item {"result":"<a title=\"Lexeme:L10\" href="" Trying value: P10 and type: wikibase-item {"result":"<a title=\"Property:P10\" href="" Trying value: Q100 and type: wikibase-item {"result":"<a title=\"Q100\" href="" Trying value: L10-F3 and type: wikibase-property {"result":"<a title=\"Lexeme:L10\" href="" Trying value: L10-S3 and type: wikibase-property {"result":"<a title=\"Lexeme:L10\" href="" Trying value: L10 and type: wikibase-property {"result":"<a title=\"Lexeme:L10\" href="" Trying value: P10 and type: wikibase-property {"result":"<a title=\"Property:P10\" href="" Trying value: Q100 and type: wikibase-property {"result":"<a title=\"Q100\" href="">
Valid JSON responses are returned but with errors with code unknown_datatype for the following datatypes:
- bad
- globecoordinate
- wikibase-entityid
- wikibase-unmapped-entityid
An example response is:
{"error":{"code":"unknown_datatype","info":"Unrecognized value for parameter \"datatype\": wikibase-entityid.","*":"See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."},"servedby":"mw1348"}
This error is also thrown for a value such as foobarwrongtype
Valid JSON responses are returned but with errors with code internal_api_error_InvalidArgumentException for the following datatypes:
- url
- commonsMedia
- geo-shape
- tabular-data
This error is also thrown for datatype=wikibase-lexeme when the id to be formatted is not equal to a valid lexemeid.
An example response is:
Trying value: L10-F3 and type: wikibase-lexeme {"error":{"code":"internal_api_error_InvalidArgumentException","info":"[W-PURwpAIDsAAIzIQboAAADF] Caught exception of type InvalidArgumentException"},"servedby":"mw1347"}
The WMF error page is shown when datatype=wikibase-form or wikibase-sense but the id value string is not a valid form or sense id (respectively).
Finally omitting the datatype parameter results in a 'correct' response but still with nice huan readable text only for items and properties:
Trying value: L10-F3 and type: {"result":"<a title=\"Lexeme:L10\" href="" Trying value: L10-S3 and type: {"result":"<a title=\"Lexeme:L10\" href="" Trying value: L10 and type: {"result":"<a title=\"Lexeme:L10\" href="" Trying value: P10 and type: {"result":"<a title=\"Property:P10\" href="" Trying value: Q100 and type: {"result":"<a title=\"Q100\" href="">
Cc: Lucas_Werkmeister_WMDE, Addshore, Nandana, Mringgaard, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, D3r1ck01, Jonas, Wikidata-bugs, aude, Lydia_Pintscher, Darkdadaah, Jdforrester-WMF, Mbch331, Jay8g, Krenair
_______________________________________________ Wikidata-bugs mailing list Wikidata-bugs@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs