This is a bit funny.
http://en.wikipedia.org/w/api.php?action=query&list=embeddedin&eitit...
Note the zero value for the limit.
The return value is as follows. The container is empty, which is okay as far as it goes.
<?xml version="1.0"?> <api> <query> <embeddedin /> </query> <query-continue> <embeddedin eicontinue="10|Stub|1922147" /> </query-continue> </api>
But note the query-continue element in the response. The result of calling the API again with the eicontinue attribute above as a parameter is of course an identical response. This could lead naively written client code into an eternal loop of repeated API calls.
I'd expect an error to be thrown here. Perhaps an API call with a limit of 0 should really be treated as invalid and an api error code should be returned, or perhaps it should be treated the same as a negative limit, which currently seems to return an empty body with no query-continue element.
2009/10/10 Tony Sidaway tonysidaway@gmail.com:
But note the query-continue element in the response. The result of calling the API again with the eicontinue attribute above as a parameter is of course an identical response. This could lead naively written client code into an eternal loop of repeated API calls.
I'd expect an error to be thrown here. Perhaps an API call with a limit of 0 should really be treated as invalid and an api error code should be returned, or perhaps it should be treated the same as a negative limit, which currently seems to return an empty body with no query-continue element.
I agree that naive clients could go into an infinite loop here, but then setting the limit to 0 and expecting that to do anything useful is equally naive. We could probably force 1 as a minimum value for limits, though.
Roan Kattouw (Catrope)
On Sat, Oct 10, 2009 at 14:04, Tony Sidaway tonysidaway@gmail.com wrote:
or perhaps it should be treated the same as a negative limit, which currently seems to return an empty body with no query-continue element
This way seems better to me, because it allows one to get zero items if they really want it.
— Kalan
mediawiki-api@lists.wikimedia.org