On Fri, Jun 01, 2012 at 02:32:49PM +0200, Bryan Tong Minh wrote:
On Fri, Jun 1, 2012 at 2:07 PM, Pavel Volek me@pavelvolek.cz wrote:
when enumerating file pages (File:...), I need to specify namespace to be enumarated so when makeing the query I set "apnamespace=6". But my question is, whether the id of namespace of media files is always the same (in every instalation of mediawiki), always "6".
Yes, the default namespace numbers are the same for all MediaWiki installations, and will always stay the same.
Note this doesn't necessarily apply to namespaces that are not in the MediaWiki core, although once assigned it's unlikely they'll change either. For example, namespace 100 is Portal on enwiki and the other language Wikipedias I checked, but is "Creator" on Commons and doesn't even exist on Meta.
You can also query the list of all namespaces and aliases from the API with action=query&meta=siteinfo&siprop=namespaces|namespacealiases.