views:

179

answers:

1

using the mediawiki API, I can list the pages in a given category. For example:

http://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Physics

returns:

<?xml version="1.0"?>
<api>
  <query>
    <categorymembers>
      <cm pageid="22939" ns="0" title="Physics" />
      <cm pageid="24489" ns="0" title="Outline of physics" />
      <cm pageid="1653925" ns="100" title="Portal:Physics" />
      <cm pageid="3445246" ns="0" title="Glossary of classical physics" />
      <cm pageid="22950086" ns="0" title="Britney Spears&#039; Guide to Semiconductor Physics" />
      <cm pageid="2129107" ns="14" title="Category:Fundamental physics concepts" />
      <cm pageid="4769321" ns="0" title="Timeline of fundamental physics discoveries" />
      <cm pageid="694942" ns="14" title="Category:Physicists" />
      <cm pageid="1198" ns="0" title="Acoustics" />
      <cm pageid="1913676" ns="14" title="Category:Applied and interdisciplinary physics" />
    </categorymembers>
  </query>
  <query-continue>
    <categorymembers cmcontinue="Atomic, molecular, and optical physics|" />
  </query-continue>
</api>

I now want to limit my query to only one MW namespace. I have tried to use the cmnamespace parameter. But

http://en.wikipedia.org/w/api.php?action=query&amp;list=categorymembers&amp;cmtitle=Category:Physics&amp;cmnamespace=0

returns the same result. How should I use this namespace parameter ?

+3  A: 

Looks like a bug in the code running on English Wikipedia - your syntax works fine for me on slightly older versions of MediaWiki.

Joshua C. Lerner
Thanks joshua, I've forwarded my question to the mw mailing list. I'll validate your answer if it is a bug (and it should be a bug :-) )
Pierre