apicategorieswikia

List all API categories in Wikia API


I am playing around with the Wikia API and have listed, for instance, all comics in the Marvel or DC Fandom Wikis, all the movies, etc.. using the following URL, where I substituted the relevant category.

https://dc.fandom.com/api/v1/Articles/List?expand=1&category=comics&namespaces=0&limit=10

Some of these categories are straightforward, so far I found movies, episodes, comics, novels, audio and characters. As far as I know, a complete list of all possible API categories is nowhere in the documentation.

Is there a way to list all possible categories? For instance, I would like to list video games, but videogames or games is not a possible category. A list would make things considerably easier.


Solution

  • Note that there is a new endpoint for the Fandom API.

    The MediaWiki query type you are looking for is Allcategories. You will want to use the API parameters

    You may also want to use

    Note that if you want to paginate through more than 500 results, you will need to also use the accontinue parameter returned in the first page of results in your next API query to get the second page of results.

    Here it is in action on the DC Fandom.

    If you already know the higher-level categories you're interest in, you may be interested in getting their subcategories using categorymembers instead. (API query). This is also the query you would use to get the pages that are members of those categories.