API:Backlinks

From MediaWiki.org
Jump to: navigation, search
Tools clipart.png This page is part of the MediaWiki API documentation.
MediaWiki API

Quick overview:

v · d · e


MediaWiki version: 1.9

Lists pages that link to a given page, similar to Special:Whatlinkshere. Ordered by linking page title.

Parameters[edit | edit source]

  • bltitle: List pages linking to this title. The title does not need to exist
  • blnamespace: Only list pages in these namespaces
  • blfilterredir: How to filter redirects
    • all: List all pages regardless of their redirect flag (default)
    • redirects: Only list redirects
    • nonredirects: Don't list redirects
  • bllimit: Maximum amount of pages to list (10 by default). Maximum limit is halved if blredirect is set
  • blredirect: If set, pages linking to bltitle through a redirect will also be listed. See below for more detailed information
  • blcontinue: Used to continue a previous request

Example[edit | edit source]

Find all pages that redirect to en:Main Page.

Other links[edit | edit source]

Links through redirects[edit | edit source]

MediaWiki version: 1.12

When the blredirect parameter is set, this module behaves slightly differently. bllimit applies to both levels separately: if e.g. bllimit=10, at most 10 first-level pages (pages that link to bltitle) and 10 second-level pages (pages that link to bltitle through a redirect) will be listed. Continuing queries also works differently, as displayed in the following example.

Get a list of pages linking to Albert Einstein (note: the initial query includes a "blcontinue" parameter for purposes of illustration)

When continuing this request, we see that there are more pages linking to Einstein, and that some of the other first-level pages are listed again. If we continue this query again, the same first-level pages will be listed in the next response, as well. To progress beyond Energy, we have to query-continue again and again until we've had all links to Einstein (or increase bllimit, of course). Continuing the previous request:

Links through transclusions[edit | edit source]

If you need to list pages as they appear in "What links here" on the MediaWiki sites with pages transcluding the desired page, you might want to try API:Embeddedin list.

Links through image usage[edit | edit source]

If you need to list pages as they appear in "What links here" on the MediaWiki sites with pages displaying the desired file, you might want to try API:Imageusage list. This also works on non-existent files.

Error Codes[edit | edit source]

  • code: blnotitle
    • info: The backlinks query requires one title to start
      • This happens when you use titles instead of bltitle (this usage is deprecated) and specify multiple titles
  • code: blbadcontinue
    • info: Invalid continue param. You should pass the original value returned by the previous query