API module "ask"

From semantic-mediawiki.org
Allows to do ask queries
API · API module · ask query · action ask · ask
Further Information
Provided by: Semantic MediaWiki
Added: 1.7.0
Removed: still available

The "ask" API module allows you to do ask queries via action "ask" (?action=ask) against Semantic MediaWiki using the MediaWiki API and get results back serialized in one of the supported formats. It was introduced with Semantic MediaWiki 1.7.0Released on 1 January 2012 and compatible with MW 1.16.x - 1.19.x.. API-module "compoundquery"Allows to do compounded ask queries provided by extension "Semantic Compound Queries"Provides a parser function that displays multiple semantic queries at the same time acts analogous to this module but additionally allows to compound several queries.

The module supports one semantic parameter, "query" (../api.php?action=ask&query=..), which takes the same string you'd feed into an #ask parser function, but URL-encoded.

Starting with Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. this module supports the "api_version" parameter1 allowing to choose between the dictionary structure { ... } (version "2", which is the default to ensure backwards compatibility for any consumer that uses the API) and the list structure [ ... ] (version "3") for the JSON serialization of the resulting data queried with the API.


Use "dictionary" structure for JSON serialization

../api.php?action=ask&query=[[Modification date::%2B]]|%3FModification date|sort%3DModification date|order%3Ddesc&format=jsonfm

run example
Use "list" structure for JSON serialization

../api.php?action=ask&query=[[Modification date::%2B]]|%3FModification date|sort%3DModification date|order%3Ddesc&format=jsonfm&api_version=3

run example
Further examples


  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:3052