Page MenuHomePhabricator

action=help doesn't return help if format is not fancy markup
Closed, ResolvedPublic

Description

Author: srbauer

Description:
action=help&format=json returns
{"error":{"code":"help","info":""}}
but no help page.

Same output for action=help&version&format=json


Version: unspecified
Severity: normal
URL: http://en.wikipedia.org/w/api.php?format=json

Details

Reference
bz10391

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:53 PM
bzimport set Reference to bz10391.

Strange. format=jsonfm does work. I'll look into this.

This bug appears to occur for *all* non-fm formats.

Created attachment 3837
Outputs help message in non-fm formats if action=help is explicitly set

ApiMain.php, lines 213-215:

// Only print the help message when this is for the developer, not runtime
if ($this->mPrinter->getIsHtml())
ApiResult :: setContent($errMessage, $this->makeHelpMsg());

It appears this is intentional behavior. I've attached a patch that detects whether the caller explicitly asked for help through action=help, and outputs the help message if that is the case.

Attached:

srbauer wrote:

Hmm, this behaviour was added in revision 22500, Mon May 28 06:59:19 2007 UTC - makes sense not to include the help page on every error in bot mode. Sorry, I had missed that change.

(In reply to comment #4)

makes sense not to include the help page on every error in bot mode.

Concur. But when specifically asked for, the help message should be printed.