Thanks André, but after testing it seems that backlinks returns something else. 
 For example this query:

http://en.wikipedia.org/w/api.php?action=query&titles=Category:Voltaire&prop=categories

Returns:

  <query>
    <pages>
      <page pageid="3465227" ns="14" title="Category:Voltaire">
        <categories>
          <cl ns="14" title="Category:Categories named after French people" />
          <cl ns="14" title="Category:Categories named after philosophers" />
          <cl ns="14" title="Category:Categories named after writers" />
        </categories>
      </page>
    </pages>
  </query>

But this query:

http://en.wikipedia.org/w/api.php?action=query&list=backlinks&bltitle=Category:Voltaire&blnamespace=14&bllimit=500

Returns:

  <query>
    <backlinks />
  </query>

If I just use "Voltaire" instead of "Category:Voltaire" then I think it's 
looking at a different page, right?  The results are different, and don't match 
the first query results:

  <query>
    <backlinks>
      <bl pageid="3465227" ns="14" title="Category:Voltaire" />
      <bl pageid="15582893" ns="14" title="Category:Novels by Voltaire" />
    </backlinks>
  </query>

Thanks in advance,

Robert


-----Original Message-----
From: Andre Engels [mailto:andreeng...@gmail.com] 
Sent: Saturday, March 19, 2011 11:08 PM
To: MediaWiki API announcements & discussion
Cc: Robert Crowe
Subject: Re: [Mediawiki-api] Portals vs categories

On Sun, Mar 20, 2011 at 2:58 AM, Robert Crowe <rob...@ourwebhome.com> wrote:
> I think of this as a tree, even though I know it's a graph.  If I send a 
> query like this:
>
> http://en.wikipedia.org/w/api.php?action=parse&page=Portal:Novels
>
> The <links> element contains <pl> items in namespaces 0 (articles), 14 
> (categories), and 100 (portals).  I interpret that as "Portal:Novels contains 
> these items", meaning that in tree terms it is the parent of those items, or 
> that those items "belong to Portal:Novels".
>
> If I send a query like this:
>
> http://en.wikipedia.org/w/api.php?cmtitle=Category:Literature&action=query&list=categorymembers&cmlimit=500&titles=Category:Literature&prop=categories
>
> The <categories> element contains <cl> items that are the categories that 
> contain Category:Literature, the parent categories.  Similarly for pages.
>
> So I'm able to list the categories that are the parents of a given category 
> or page, but I can't seem to find a way to list the portals that are the 
> parents of a given category or page.  Is there a way to do that?  Basically 
> I'm just trying to navigate the tree.

http://en.wikipedia.org/w/api.php?action=query&list=backlinks&bltitle=Voltaire&blnamespace=100&bllimit=500

(replace Voltaire by whichever page you're interested in)

-- 
André Engels, andreeng...@gmail.com


_______________________________________________
Mediawiki-api mailing list
Mediawiki-api@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api

Reply via email to