Last modified: 2014-02-12 23:45:33 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 T34624, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 32624 - API support for useformat=mobile
API support for useformat=mobile
Status: RESOLVED FIXED
Product: MobileFrontend
Classification: Unclassified
Feature requests (Other open bugs)
unspecified
All All
: Unprioritized enhancement
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: noncoreapi
  Show dependency treegraph
 
Reported: 2011-11-24 12:16 UTC by Roan Kattouw
Modified: 2014-02-12 23:45 UTC (History)
11 users (show)

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


Attachments

Description Roan Kattouw 2011-11-24 12:16:44 UTC
Copying request from the mediawiki-api list. Tried to get the reporter to report this themselves, but apparently the restrictions put in place after the spam attack prevented that.

http://lists.wikimedia.org/pipermail/mediawiki-api/2011-November/002431.html

================================

Hi All,
Will the useformat=mobile be supported by MediaWiki API where appropriate?

I am able to do the following for non mobile content
$.getJSON('http://en.wikipedia.org/w/api.php?action=parse&page='+encodeURIComponent(query)+'&prop=text&format=json&callback=?', function(json) { 
// do stuff
});

It would be nice if adding the parameter useformat=mobile would get the json object of the mobile page content

like http://en.wikipedia.org/wiki/Main_Page?useformat=mobile&format=json

but this link returns a file containing a json object of the page content

Regards,

Asher Szmulewicz
Comment 1 Asher Szmulewicz 2011-12-29 09:38:09 UTC
This feature is supported since Dec 16th 2011 thanks to Patrick Reilly who added JSONP/callback support 
It is working very well in all browsers except IE9 (yes it works in IE7 and 8)
The problem is a security problem
see http://stackoverflow.com/questions/5986772/ie9-script-response-blocked-due-to-mime-type-mismatch
the solution of the problem from the msdn guys
The problem is an X-Content-Type-Options: nosniff declaration and returning a JavaScript file without a JavaScript MIME type. This can only be fixed by either removing the nosniff declaration or by fixing the MIME type to indicate that the file is, in fact, script.
Can you please fix this
Thanks
Asher Szmulewicz
Comment 2 Krinkle 2011-12-29 09:55:18 UTC
Probably better if done through the API ?
Comment 3 Asher Szmulewicz 2011-12-29 11:30:31 UTC
You may be right since the API works in IE9 
In the meantime if the response header is changed from
Content-Type:application/json (this is its value today) to
Content-Type:text/javascript
it will work also for IE9 w/o changing the X-Content-Type-Options: nosniff
Comment 4 Krinkle 2011-12-29 11:50:19 UTC
Extension:MobileFrontend could provide an API to something like api.php?action=query&list=mobilecontent
Comment 5 Asher Szmulewicz 2011-12-29 12:48:30 UTC
(In reply to comment #4)
> Extension:MobileFrontend could provide an API to something like
> api.php?action=query&list=mobilecontent

I thought adding the parameter useFormat=mobile (to be consistent with extension:mobileFrontend) whenever possible in the api.  
I am using the following
$.getJSON('http://en.wikipedia.org/w/api.php?action=parse&page='+encodeURIComponent(query)+'&prop=text&format=json&callback=?',
function(json) { 
// do stuff
});
It would become
$.getJSON('http://en.wikipedia.org/w/api.php?action=parse&page='+encodeURIComponent(query)+'&prop=text&format=json&useFormat=mobile&callback=?',
function(json) { 
// do stuff
});
Comment 6 Max Semenik 2012-02-11 08:16:36 UTC
I'm currently working on this. It looks the following way: api.php?action=parse&page=foo&mobileformat=wml

As it's part of the normal API, all usual formats are supported, unlike the current hack.
Comment 7 Max Semenik 2012-02-14 20:09:31 UTC
Implemented in trunk.

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


Navigation
Links