API:Alllinks

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

MediaWiki action API

v · d · e

Returns a list of (unique) links to pages in a given namespace starting ordered by link title.

Parameters[edit]

  • alcontinue: When more results are available, use this to continue.
  • alfrom: The title of the link to start enumerating from.
  • alto: The title of the link to stop enumerating at.
  • alprefix: Search for all linked titles that begin with this value.
  • alunique: Only show distinct linked titles. Cannot be used with alprop=ids. When used as a generator, yields target pages instead of source pages. Before MW 1.21 (gerrit:40559) it couldn't be used in generator mode.
  • alprop: Which pieces of information to include: (Default: title)
    • ids: Page IDs of the linking pages. Cannot be used together with alunique.
    • title: Link titles
  • alnamespace: The namespace to enumerate. You can only enumerate one namespace at a time. (Default: 0)
  • allimit: How many total items to return. No more than 500 (5000 for bots) allowed. (Default: 10)
  • aldir: The direction in which to list. Possible values: ascending, descending. (Default: ascending)

Example[edit]

List all links to talk pages whose name starts with Talk:API

Error Codes[edit]

Code Info
alparams alllinks cannot be used as a generator in unique links mode
alparams alllinks cannot return corresponding page ids in unique links mode
Note: This happens when you use alunique and alprop=ids together
alparams alcontinue and alfrom cannot be used together




(main | query | alllinks)
  • This module requires read rights.
  • This module can be used as a generator.
  • Source: MediaWiki
  • License: GPL-2.0+

Enumerate all links that point to a given namespace.

Parameters:
alcontinue

When more results are available, use this to continue.

alfrom

The title of the link to start enumerating from.

alto

The title of the link to stop enumerating at.

alprefix

Search for all linked titles that begin with this value.

alunique

Only show distinct linked titles. Cannot be used with alprop=ids.

When used as a generator, yields target pages instead of source pages.

Type: boolean (details)
alprop

Which pieces of information to include:

ids
Adds the page ID of the linking page (cannot be used with alunique).
title
Adds the title of the link.
Values (separate with | or alternative): ids, title
Default: title
alnamespace

The namespace to enumerate.

One of the following values: -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 486, 487, 828, 829, 1198, 1199, 2300, 2301, 2302, 2303, 2600, 5500, 5501
Default: 0
allimit

How many total items to return.

No more than 500 (5,000 for bots) allowed.
Type: integer or max
Default: 10
aldir

The direction in which to list.

One of the following values: ascending, descending
Default: ascending
Examples:
List linked titles, including missing ones, with page IDs they are from, starting at B.
api.php?action=query&list=alllinks&alfrom=B&alprop=ids|title [open in sandbox]
List unique linked titles.
api.php?action=query&list=alllinks&alunique=&alfrom=B [open in sandbox]
Gets all linked titles, marking the missing ones.
api.php?action=query&generator=alllinks&galunique=&galfrom=B [open in sandbox]
Gets pages containing the links.
api.php?action=query&generator=alllinks&galfrom=B [open in sandbox]