How do I get a list of MediaWiki namespaces? Ideally with name and number.
Pages on a MediaWiki wiki are grouped into collections called “namespaces” which differentiate between the purpose of the pages at a high level. Pages in certain namespaces can also have special properties or behave differently when they interact with other pages.
A Wikipedia namespace is a set of Wikipedia pages whose names begin with a particular reserved word recognized by the MediaWiki software (followed by a colon). For example, in the user namespace all titles begin with the prefix User:.
Wikipedia and other Wikimedia projects are free, collaborative repositories of knowledge, written and maintained by volunteers from around the world. The Wikimedia API gives you open access to add this free knowledge to your projects and apps.
MediaWiki is a free and open-source wiki software. It is used on Wikipedia and almost all other Wikimedia websites, including Wiktionary, Wikimedia Commons and Wikidata; these sites define a large part of the requirement set for MediaWiki.
Use the API: api.php?action=query&meta=siteinfo&siprop=namespaces
For example: http://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop=namespaces
You can also get other formats such as JSON.
See also MediaWiki documentation for more info
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With