Thank you and that makes sense. I'm trying to change the code now to support redirects since it gets a different JSONObject (key is not categories for redirects) for redirects.

***one other question, for the title "Nervous system", I need to query into 3 layers. for the firs time it gives me 3 categories,
  1.  Nervous system
  2.  Neurobiology
  3.  Neuroscience

Then I need to query each of these 3 categories to get their sub categories. but in a loop when I parse again Nervous system, it gives me the same three results but I want to get the results as I traverse in Wikipedia manually. In Wikipedia, when I search "Nervous system", it gives me these three results first and then when I click on the category Nervous system (in the initial result of categories), it gives me "Organ systems" and "Mind". How can I do this in the code with MediaWiki API?

Kalpa Gunaratna



----- Original Message -----
From: Brad Jorsch <b-jorsch@alum.northwestern.edu>
Date: Wednesday, August 3, 2011 3:28 pm
Subject: Re: [Mediawiki-api] categories query does not return any results.
To: MediaWiki API announcements & discussion <mediawiki-api@lists.wikimedia.org>

> On Wed, Aug 03, 2011 at 02:40:52PM -0400, Dalkandura Arachchige
> Gunaratna wrote:
> >
> > For example, "Populated places" does not return any category listing
> > for the query but if you search Wikipedia, it gives categories.
>
> No it doesn't.
> http://en.wikipedia.org/w/index.php?title=Populated_places&redirect=no
>
> Perhaps you did not notice you followed a redirect to [[Populated
> place]], no 's'?
>
> If you want the API to follow redirects, add '&redirects' to
> your query:
>
> http://en.wikipedia.org/w/api.php?action=query∝=categories&titles=Populated+places&format=json&cllimit=50&clshow=%21hidden&redirects
>
> _______________________________________________
> Mediawiki-api mailing list
> Mediawiki-api@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api