Last modified: 2012-09-16 07:16:47 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 T32369, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 30369 - No way of knowing how many '|'-separated values some parameters can take
No way of knowing how many '|'-separated values some parameters can take
Status: RESOLVED WORKSFORME
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.17.x
All All
: Unprioritized enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-08-14 18:54 UTC by Daniel A. R. Werner
Modified: 2012-09-16 07:16 UTC (History)
6 users (show)

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


Attachments

Description Daniel A. R. Werner 2011-08-14 18:54:22 UTC
Some API Modules like action=query offer parameters that take multiple values separated by '|'. But for a bot class, there is no way of knowing how many values are allowed and when sending more than the limit, there might be no way of knowing how many have been rejected in some cases.
For example, you want to export revisions, you would call something like "api.php?action=query&revids=1|2|3|4|...|1000|1001&export", trying to request 1001 revisions to be exported, you would end up with only 50 or 500 (depending on whether you are a bot/sysop or whatever) without even knowing it.
The only clue, the API will give you is a warning tag within the result. The information given there doesn't really provied machine friendly semantics though. Its just:
  <warnings>
    <query xml:space="preserve">Too many values supplied for parameter 'revids': the limit is 50</query>
  </warnings>
There should be some more machine friendly information provided to check whether the request must be sent in little portions or not. Pretty much like the query-continue tag when running into result limitations.
Comment 1 db [inactive,noenotif] 2011-08-15 18:48:14 UTC
You can use action=paraminfo for this information.

In this example it is api.php?action=paraminfo&pagesetmodule=, which gives you

      <parameters>
        <param name="titles" description="A list of titles to work on" multi="" limit="50" lowlimit="50" highlimit="500" type="string" />
        <param name="pageids" description="A list of page IDs to work on" multi="" limit="50" lowlimit="50" highlimit="500" type="integer" />
        <param name="revids" description="A list of revision IDs to work on" multi="" limit="50" lowlimit="50" highlimit="500" type="integer" />
      </parameters>

You can see that revids = 50.

Having a continue for the rest is also an idea.
Comment 2 Sam Reed (reedy) 2011-08-15 18:57:26 UTC
Most of this bug is WORKSFORME then?
Comment 3 Daniel A. R. Werner 2011-08-15 20:24:26 UTC
Have found this action=paraminfo in the meanwhile, so it's not impossible to handle.
But still, would be a nice feature to have some continue tag. It would be more consistent since we have the same for the result limit and since we wouldn't have to do another query for it.
Also, in theory, we had to do a action=paraminfo query for each qery module with such parameters because the limit could differ, so it would be much easier to work with a continue tag which is telling us the actual limit. The warning tag which is in the result right now in such a case really is kind of ridiculous in its current form.
Comment 4 db [inactive,noenotif] 2011-08-18 20:11:24 UTC
(In reply to comment #3)
> Also, in theory, we had to do a action=paraminfo query for each qery module
> with such parameters because the limit could differ, so it would be much easier
> to work with a continue tag which is telling us the actual limit.

action=paraminfo can handle more than one module at one call. 

revids/titles/pageids is only one parameter and is not handled by each query module seperate, for that parameter you have only to call the paraminfo ones, but if you want all limits of all modules, you have to ask for each modules.
Comment 5 Bryan Tong Minh 2011-10-06 20:22:31 UTC
Was looking into this, but found out that ApiBase::setWarning() is a piece of crap that might need some rethinking.
Comment 6 db [inactive,noenotif] 2012-09-16 07:16:47 UTC
WORKSFORME per comment 2

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


Navigation
Links