Pavel Volek | 1 Jun 2012 14:07
Picon

Identification of namespaces

Hi,
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".
Thanks a lot.
Pavel
Bryan Tong Minh | 1 Jun 2012 14:32
Picon
Gravatar

Re: Identification of namespaces



On Fri, Jun 1, 2012 at 2:07 PM, Pavel Volek <me <at> pavelvolek.cz> wrote:
Hi,
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".
Thanks a lot.
Pavel

Yes, the default namespace numbers are the same for all MediaWiki installations, and will always stay the same.


Bryan
_______________________________________________
Mediawiki-api mailing list
Mediawiki-api <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Brad Jorsch | 1 Jun 2012 19:09

Re: Identification of namespaces

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 <at> 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.

Gmane