[Mediawiki-l] Getting the pages in a given category.

Pierre LINDENBAUM plindenbaum at yahoo.fr
Wed Jul 15 16:08:56 UTC 2009


Hi all,
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>
       <cmpageid="22939"ns="0"title="Physics"/>
       <cmpageid="24489"ns="0"title="Outline of physics"/>
       <cmpageid="1653925"ns="100"title="Portal:Physics"/>
       <cmpageid="3445246"ns="0"title="Glossary of classical physics"/>
       <cmpageid="22950086"ns="0"title="Britney Spears&#039; Guide to Semiconductor Physics"/>
       <cmpageid="2129107"ns="14"title="Category:Fundamental physics concepts"/>
       <cmpageid="4769321"ns="0"title="Timeline of fundamental physics discoveries"/>
       <cmpageid="694942"ns="14"title="Category:Physicists"/>
       <cmpageid="1198"ns="0"title="Acoustics"/>
       <cmpageid="1913676"ns="14"title="Category:Applied and interdisciplinary physics"/>
     </categorymembers>
   </query>
   <query-continue>
     <categorymemberscmcontinue="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&list=categorymembers&cmtitle=Category:Physics&cmnamespace=0

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


      



More information about the MediaWiki-l mailing list