Last modified: 2011-03-13 18:05:08 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 22603 - Malformed response when no params provided
Malformed response when no params provided
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
unspecified
All All
: Lowest minor (vote)
: ---
Assigned To: Roan Kattouw
http://en.wikipedia.org/w/api.php?act...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-02-21 03:56 UTC by Smallman
Modified: 2011-03-13 18:05 UTC (History)
6 users (show)

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


Attachments

Description Smallman 2010-02-21 03:56:15 UTC
When looking at 

http://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop

It returns:

You are looking at the HTML representation of the XML format.
HTML is good for debugging, but probably is not suitable for your application.
See complete documentation, or API help for more information.

<?xml version="1.0"?>
<api />

This is not valid xml. 

What it should return is: (as when you look at http://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&sipro)

You are looking at the HTML representation of the XML format.
HTML is good for debugging, but probably is not suitable for your application.
See complete documentation, or API help for more information.

<?xml version="1.0"?>
<api>
  <query>
    <general mainpage="Main Page" base="http://en.wikipedia.org/wiki/Main_Page" sitename="Wikipedia" generator="MediaWiki 1.16alpha-wmf" phpversion="5.2.4-2ubuntu5.7wm1" phpsapi="apache2handler" dbtype="mysql" dbversion="5.1.43-wm3193-log" rev="59858" case="first-letter" rights="Creative Commons Attribution-Share Alike 3.0 Unported" lang="en" fallback8bitEncoding="windows-1252" writeapi="" timezone="UTC" timeoffset="0" articlepath="/wiki/$1" scriptpath="/w" script="/w/index.php" variantarticlepath="" server="http://en.wikipedia.org" wikiid="enwiki" />
  </query>
</api>

There is a related thread at WP:VPT  (http://en.wikipedia.org/wiki/Wikipedia:Vpt#API_version)
Comment 1 Smallman 2010-02-21 04:04:08 UTC
On second thought, it really should return an error message as http://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&sifilteriw does

so it should return something like:

<?xml version="1.0"?>
<api>
  <error code="siunknown_siprop" info="Unrecognized value for parameter &#040;siprop&#040;: " xml:space="preserve">
</api>

It should return some kind of error message, not a borked api message as it currently does.
Comment 2 Smallman 2010-02-21 04:06:23 UTC
It seems the same error afflicts http://en.wikipedia.org/w/api.php?action=query&meta
Comment 3 Smallman 2010-02-21 04:08:14 UTC
http://en.wikipedia.org/w/api.php?action=query&metadvc also gives bad return...

Tmrw I'll open a small series of bugs after I check all the api modules.
Comment 4 Sam Reed (reedy) 2010-02-21 13:45:01 UTC
Do you really mean version 1.3?
Comment 5 Smallman 2010-02-21 14:01:30 UTC
I thought I hit unspecified...oops.
Comment 6 Smallman 2010-02-21 14:14:24 UTC
I've looked at http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/api/ApiQuerySiteinfo.php and the problem is that it assumes there are parameters.

What it should say is something like this

    public function execute() {
        $params = $this->extractRequestParams();
        if(empty($params))
            ApiBase :: dieDebug( __METHOD__, "No prop specified..." );
        else
        {
        $done = array();
        foreach ( $params['prop'] as $p )
        {
          ....
      
It could give better error handling, but it would suffice for now...

It's probably best to add something into extractRequestParams() to make it return an error code when no params are given, rather than go through and add if(empty($params)) to all of the api php scripts...
Comment 7 Bryan Tong Minh 2010-02-21 14:34:38 UTC
If you don't specify something to return, it should not be unexpected that nothing it result.

The response is valid XML anyway: http://validator.w3.org/check?uri=http%3A%2F%2Fen.wikipedia.org%2Fw%2Fapi.php%3Faction%3Dquery%26meta%3Dsiteinfo%26siprop%26format%3Dxml&charset=%28detect+automatically%29&doctype=Inline&group=0

Recommending WONTFIX.
Comment 8 Smallman 2010-02-21 15:18:45 UTC
You are right, it is valid xml, just not well formed.

Looking at http://en.wikipedia.org/w/api.php?action=query&format=xml, it returns
<?xml version="1.0"?><api />

I'd like for it to return an error code as no parameter/prop specified.
Comment 9 Alex Z. 2010-02-21 18:24:11 UTC
I tend to agree with Bryan. You're requesting no information, I don't see why its wrong to return no information.
Comment 10 Smallman 2010-02-21 22:36:45 UTC
Well you are specifying which module.

If I do http://en.wikipedia.org/w/api.php?action=quey&format=xml
I do get an error response:
<api>
<error code="unknown_action" info="Unrecognized value for parameter 'action': quey"/>
</api>

But if I do http://en.wikipedia.org/w/api.php?action=query&format=xml
I get 
<api/>

It should throw an error that no parameter was specified, not give no information.
Comment 11 Roan Kattouw 2010-02-22 18:21:48 UTC
Closing as WONTFIX per comment #7.

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


Navigation
Links