Listing all Namespaces in MediaWiki with their ID numbers

I spotted a request on Twitter earlier today from someone asking if it was possible to list all namespaces within a MediaWiki installation with their ID numbers. Of course, MediaWiki being MediaWiki, there is a way to do this.

So, it’s possible to get the list of all MediaWiki namespace names and their respective IDs by querying MediaWiki’s API, as falso rolex follows (where is the installation directory):

This returns an falso rolex XML file which lists what you’re after. If you found that helpful, you’ll almost certainly find our MediaWiki training courses of use!

Related: there’s also an explanation of what a namespace in MediaWiki is, and potential uses for them.