Last modified: 2014-06-17 16:18:51 UTC
api.php?action=query&prop=redirects&format=json&rdlimit=10&titles=Foobar&generator=redirects&grdlimit=10 Answers with { "query": { "pages": { "111": { "pageid": 111, "ns": 0, "title": "Foobar", "redirects": [ { "pageid": "222", "ns": 0, "title": "Foobar 2" }, { "pageid": "333", "ns": 0, "title": "Foobar 3" } ] } } } } when redirects exits, but it answers with [] when no redirects exists. Expected result: { "query": { "pages": { "111": { "pageid": 111, "ns": 0, "title": "Foobar", "redirects": [] } } } }
*** This bug has been marked as a duplicate of bug 10887 ***
Are they really the same thing? Returning {} instead of [] is not expected here either.
(In reply to Liangent from comment #2) > Are they really the same thing? Returning {} instead of [] is not expected > here either. Good point. The bug report is actually incorrect and is just INVALID, and I didn't read it closely enough to notice that. The text claimed as the response "when redirects exists" is in fact *not* the response that would be given for that query. The response would look more like this: { "query": { "pages": { "222": { "pageid": 222, "ns": 0, "title": "Foobar 2" }, "333": { "pageid": 333, "ns": 0, "title": "Foobar 3" } } } } If there are no redirects to "Foobar", then returning "[]" or "{}" is absolutely expected (the difference being a matter for bug 10887). The query that *does* give the claimed response "when redirects exist" would be something like api.php?action=query&prop=redirects&format=json&rdlimit=10&titles=Foobar. And when no redirects exist, that *does* actually give what is claimed as the "expected" result (except for the fact that the API doesn't normally return an empty subarray, be it for prop=redirects, prop=images, or anything else).