A way to know which features api.php supports
Closed, ResolvedPublic

Description

Author: hippytrail

Description:
Sometimes it's good to make flexible JavaScript that can do something better or more efficiently if api.php has a new feature but fall back to a rougher or less efficient way if the feature is missing.

Currently we only have wgVersion but many changes occur on live wikis between version.

We could expose the svn revision as a JavaScript wg constant but forked wikis such as Wikia may have different svn revisions thus breaking any connection between the MediaWiki revision and the api.php feature set.

It may be possible to have some kind of feature array but that could be bulky.

Best might be a universal wgApiRevision which is not dependent on svn and thus will be the same even if you're on a forked wiki, forked api.php would be another story however.

In any case it's surely a good idea to expose the information provided by api.php's "version" parameter. Currently it only outputs flat text when viewing help but could output structured data for JSON and all formats.

In my case I have three ways to achieve my goal. If api.php is not available I can do several ajax hits to the server which results in partial information. If api.php is available I can do a single ajax server hit but need to request more data than strictly necessary. If api.php supports the "amlang" parameter for "meta=allmessages" I can get everything I need with a single efficient ajax server hit.

Currently, however, there is no deterministic way to know if "amlang" is supported.


Version: unspecified
Severity: enhancement

bzimport added a project: MediaWiki-API.Via ConduitNov 21 2014, 10:07 PM
bzimport set Reference to bz12718.
bzimport created this task.Via LegacyJan 21 2008, 7:49 AM
vvv added a comment.Via ConduitJan 21 2008, 1:38 PM

You can try standard error handling way now. Though, action=capable should be implemented

Catrope added a comment.Via ConduitJan 21 2008, 2:53 PM

(In reply to comment #1)

You can try standard error handling way now. Though, action=capable should be
implemented

It should. Still, you can regex the action=help output for "amlang".

Catrope added a comment.Via ConduitJan 22 2008, 9:22 PM

Implemented in r30062

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.