Last modified: 2013-04-16 20:18:34 UTC
Extensions are allowed to add parameters to arbitrary API modules. And they can even avoid adding these parameters in a way that module will see them when calling extractRequestParams(). But if the extension does this and then accesses these parameters directly via $wgRequest (which may be required, as the extension may not be able to get access to the ApiMain), ApiMain never knows about it and generates an "unrecognized parameter" warning.
You should use the 'APIGetAllowedParams' hook to add the params, than extractRequestParams() will extract and validate it and marked it as used, than you have not a problem with unrecognized parameters. With 'APIGetParamDescription' you can add help for the autodoc and action=paraminfo All other ways are not the common way, so you have to live with such warnings and maybe other things. Do you want a new hook, when ApiMain::getParamsUsed is called, to add your own parameters there and avoid the warning? Use the first hook, makes live easier, because the api will validate you param and die in a documented way for invalid input.
(In reply to comment #1) > You should use the 'APIGetAllowedParams' hook to add the params, than > extractRequestParams() will extract and validate it and marked it as used, > than > you have not a problem with unrecognized parameters. I think you are not up to date on the "$flags" parameter that was recently added to APIGetAllowedParams. Also keep in mind that some very strange things should not show up in the auto-generated help, e.g. how ConfirmEdit copies "captchaid" to "wgCaptchaId". But perhaps the thing to do is to require anything using APIGetAllowedParams to include its parameters when $flags is 0, and live with modules possibly getting extra parameters returned in extractRequestParams(). I'm not sure.