Legoktm has just merged Gerrit change 160798,[1] Gerrit change 161093,[2]
Gerrit change 160819,[3] and a few associated patches. Collectively, these
make the following changes to the human-readable aspects of the API output,
which will be deployed to WMF wikis with 1.25wmf4 (see
https://www.mediawiki.org/wiki/MediaWiki_1.25/Roadmap for the schedule).
* action=help now outputs a nice HTML page instead of a plain-text document
wrapped in XML.
* Hitting api.php with no parameters will display help for the main module
only, with links to each submodule. One of the examples provided shows how
to get everything on one page as with the old help.
* The default for the 'format' parameter is now jsonfm rather than xmlfm.
* Syntax highlighting for format=jsonfm and format=xmlfm now uses
Extension:SyntaxHighlight_GeSHi rather than ad-hoc code that only worked
right for xmlfm. Other formats are not highlighted.
The patches also change the aspects of action=paraminfo that return
help-related information:
* Module description is no longer returned by default; a new parameter
selects html, wikitext, or raw Message data.
* The 'examples' result property is now an array rather than a string.
* The 'allexamples' result property has been removed.
* Parameter descriptions are no longer returned by default; a new parameter
selects html, wikitext, or raw Message data. Machine-readable parameter
info remains available.
The impact of these changes on existing bots and scripts is expected to be
minimal, as non-human consumption is likely to be limited to ApiSandbox.
[1]: https://gerrit.wikimedia.org/r/#/c/160798
[2]: https://gerrit.wikimedia.org/r/#/c/161093
[2]: https://gerrit.wikimedia.org/r/#/c/160819
--
Brad Jorsch (Anomie)
Software Engineer
Wikimedia Foundation
With the success of prop=redirects, in Gerrit change 155592[1] I added new
prop modules prop=linkshere, prop=fileusage, and prop=transcludedin, which
are roughly equivalent to list=backlinks, list=imageusage, and
list=embeddedin but can work on a list of titles (including titles from a
generator).
They should be deployed to WMF wikis with 1.25wmf1 (unless we call it
1.24wmf23 after all), see
https://www.mediawiki.org/wiki/MediaWiki_1.25/Roadmap for the schedule.
I'm considering deprecating list=backlinks, list=imageusage, and
list=embeddedin at some point in favor of these new prop modules. Opinions
on this are welcome.
[1]: https://gerrit.wikimedia.org/r/#/c/155592/
--
Brad Jorsch (Anomie)
Software Engineer
Wikimedia Foundation
The fact that the hex-encoded sortkey must be converted to binary format
for prop=categorymembers cmstartsortkey and cmendsortkey has long been an
odd wart in the API.
Bug 70690[1] showed that the binary values for these parameters is actively
breaking on some wikis. In Gerrit change 159746[2] these parameters have
been deprecated in favor of new parameters cmstarthexsortkey and
cmendhexsortkey which take the sortkey in the same hex-encoded format that
is returned by the API.
This change should be deployed to WMF wikis with 1.24wmf22, see
https://www.mediawiki.org/wiki/MediaWiki_1.24/Roadmap for the schedule.
[1]: https://bugzilla.wikimedia.org/show_bug.cgi?id=70690
[2]: https://gerrit.wikimedia.org/r/#/c/159746/
--
Brad Jorsch (Anomie)
Software Engineer
Wikimedia Foundation
I've just submitted Gerrit change 153110[1] which will overhaul the token
handling in the API, as described on the API Roadmap RFC.[2] The patch is
not merged yet, feel free to join in the code review or reply with
comments. Follow the Gerrit change for any changes to the information
below. A followup to this announcement with deployment dates will be sent
once the change is merged.
For clients, all the old methods of fetching tokens will continue to work
with deprecation warnings. Usage levels of the deprecated methods on
queries to WMF wikis will be evaluated once the MediaWiki 1.25 development
cycle begins.
Changes visible to clients include:
* All tokens are available from the new meta=tokens query submodule.
** The "centralauth" token, which was provided by action=tokens but wasn't
really a token in the sense of the rest, is now available from
action=centralauthtoken.
** Note that it is possible to use meta=tokens along with other query prop,
list, and meta modules.
* The help for all token parameters clearly indicates which type of token
is needed.
* The output from action=paraminfo includes the token type as a property on
the subobject describing the token parameter.
* All tokens may be cached as long as the session is valid; none are
dependent on factors such as the page being edited or the user being
targeted.
* Most token types have been replaced with a single 'csrf' token. This has
long been the case in practice (e.g. see [3]), this just makes it official.
* The tokens returned for action=rollback and action=userrights (and
certain extension modules) are no longer the same tokens used in the
corresponding features in the web UI. The web UI tokens are accepted by the
API for compatibility, but not vice versa.
* Any API query (with a few exceptions, mainly queries to the 'feed'
modules) will return the current timestamp when passed the 'curtimestamp'
parameter. This may be used to fetch the starttimestamp necessary for
action=edit.
For extension authors, if your extension uses the core token handling it
*will* need updating. I've already submitted patches for the 26 extensions
hosted in WMF's Gerrit repository. The necessary changes are:
* needsToken() must return a string or false; true will result in an error.
Unless there are special security issues that require a custom salt, 'csrf'
should be returned.
** Since any truthy string is equivalent to the old behavior of returning
boolean true, this will continue to work with older versions of MediaWiki.
* If a custom salt is needed, the new 'ApiQueryTokensRegisterTypes' hook
must be used to register it.
* If web UI will be using a different salt (e.g. because it's included in
links rather than posted form fields), a method getWebUITokenSalt() may be
overridden to supply this salt for compatibility.
* It is no longer necessary to return data for 'token' from
getAllowedParams() or getParamDescription(). Any return from
getAllowedParams() will be overridden; a string from getParamDescription()
will also be overridden with a standard message, while an array will have
the standard message prepended.
** Compatibility with older versions of MediaWiki may be maintained by
continuing to return data for 'token' from getAllowedParams() and a string
for 'token' from getParamDescription().
* getTokenSalt() is no longer called or defined in ApiBase, and may be
removed once compatibility with older versions of MediaWiki is no longer
needed.
[1]: https://gerrit.wikimedia.org/r/#/c/153110/
[2]:
https://www.mediawiki.org/wiki/Requests_for_comment/API_roadmap#Token_handl…
[3]:
https://en.wikipedia.org/w/api.php?format=jsonfm&action=tokens&type=block|d…
--
Brad Jorsch (Anomie)
Software Engineer
Wikimedia Foundation
With the merge of Gerrit change 154098,[1] various seldom-used API output
formats are now deprecated: dbg, dump, txt, wddx, and yaml. Clients using
any of these formats should transition to the json format.
In addition, any clients still using deprecated parameters to other
modules[2] should transition to the non-deprecated replacements. We've
begun logging the use of these parameters on WMF wikis, and when usage
drops sufficiently they may be removed.
Plans are also underway to improve the json format.[2] This may result in
the deprecation of format=json in favor of format=json2; if you would like
to provide input on the planned changes or on whether the improved format
should be "format=json2" or something else, please comment at the linked
page.
Thanks.
[1]: https://gerrit.wikimedia.org/r/#/c/154098/
[2]:
https://www.mediawiki.org/wiki/Requests_for_comment/API_roadmap#Removal_of_…
[3]:
https://www.mediawiki.org/wiki/Requests_for_comment/API_roadmap#Changes_to_…
--
Brad Jorsch (Anomie)
Software Engineer
Wikimedia Foundation
If you want to give input on numerous proposed changes to the API, please
comment at https://www.mediawiki.org/wiki/Requests_for_comment/API_roadmap
Also, please advertise that link on-wiki at any suitable locations. Thanks.
--
Brad Jorsch (Anomie)
Software Engineer
Wikimedia Foundation
The 'languageshtml' result property for action=parse has been deprecated
for some time now, and with the merge of Gerrit change 143299[1] is now
removed entirely. This will be deployed to WMF wikis with 1.24wmf12; see
https://www.mediawiki.org/wiki/MediaWiki_1.24/Roadmap for the schedule.
[1]: https://gerrit.wikimedia.org/r/#/c/143299/
--
Brad Jorsch (Anomie)
Software Engineer
Wikimedia Foundation
The "protorel" property recently added to the output of
action=query&meta=siteinfo&siprop=interwikimap was coded to include the
property with a boolean true value rather than the API-standard empty
string. This is now corrected, and will be deployed to WMF wikis with
1.24wmf10.
At some point in the future (timeframe and details undecided yet), I would
like to change the API so that boolean properties like this one will
actually be a truthy value (e.g. boolean true) in JSON and other output
formats. It's likely that the backwards-compatible mode would cause any
other properties that are currently returning as boolean true to change to
empty-string.
--
Brad Jorsch (Anomie)
Software Engineer
Wikimedia Foundation
With Gerrit change 136799 <https://gerrit.wikimedia.org/r/#/c/136799/>, the
old output format for action=expandtemplates and the generatexml parameter
are deprecated, but will continue to be used for existing queries.
Clients should begin using the new 'prop' parameter to
action=expandtemplates, to be ready for some future date when the
deprecated format and parameter are removed. There is no timeline on this
removal, but it will be announced well in advance to this list.
This change will be deployed to WMF wikis with 1.24wmf8, see
https://www.mediawiki.org/wiki/MediaWiki_1.24/Roadmap for the schedule.
This is not considered a breaking change, since the old queries will
continue to work with a deprecation warning.
--
Brad Jorsch (Anomie)
Software Engineer
Wikimedia Foundation