Last modified: 2008-08-05 16:13:28 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T17044, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 15044 - give API an id type parameter for parallel operations
give API an id type parameter for parallel operations
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Roan Kattouw
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-08-05 09:24 UTC by Splarka
Modified: 2008-08-05 16:13 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Splarka 2008-08-05 09:24:35 UTC
Often when working with the API I'll end up needing to do several parallel operations, such as with format=json and using callbacks. This can be annoying, requiring re-scraping the page to figure out what triggered what, and doing fragile matching in the process.

An alternative I've found is to use eval() to generate a unique callback function for each object, eg:

 var url = wgServer + wgScriptPath + '/api.php?action=query&format=json&callback=usiCB' + i;
  eval('usiCB' + i + ' = function(tobj) { usiCB(tobj,' + i + ')}');

But this can be a pain for hundreds of parallel or potential operations. Per IRC convo with Roan a possible solution vector is a generic ID parameter for all formats:

something like &requestid=foo or &apiid=foo could generate (in the various formats):

 ({
	"id":"foo",
	"query": {
	},
 })

 <api id="foo">

 array('api' => array('id' => 'foo', 'query' => ...

This would greatly facilitate usage of parallel scripts by giving the calling code a way to trace back what requested the query.
Comment 1 Roan Kattouw 2008-08-05 16:13:28 UTC
Fixed in r38638

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links