Author: stephen.bain
Description:
Allows the backlinks query to return the standard data structure when the query returns an empty dataset.
Some list type queries return the standard data structure but an empty dataset when, because of a supplied parameter, the query returns no results, for example, the categorymembers query:
http://www.mediawiki.org/w/api.php?action=query&list=categorymembers&cmcategory=NonExistentCategory
<?xml version="1.0" encoding="utf-8"?>
<api>
<query> <categorymembers /> </query>
</api>
However some don't return the standard data structure, for example, the backlinks query:
http://www.mediawiki.org/w/api.php?action=query&list=backlinks&bltitle=NonExistentPage
<?xml version="1.0" encoding="utf-8"?>
<api />
And in another varient, although the usercontribs query returns the standard data structure with an empty dataset when a nonexistent user is specified, the logevents query returns an error when a nonexistent user is specified.
Is there any good reason why these queries should behave differently?
Attached is an extremely simple patch to allow the backlinks query to return the standard data structure when the query returns an empty dataset. I'll try to track how this can be addressed in the other affected queries.
Version: unspecified
Severity: normal
attachment api_backlinks_empty_dataset.patch ignored as obsolete