API:Allpages/de

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page API:Allpages and the translation is 0% complete.

Other languages:
Deutsch • ‎English • ‎dansk • ‎français • ‎polski • ‎日本語
MediaWiki version: 1.18

GET request to list all pages fitting certain criteria, within a given Handbuch:Namensraum .

This module can be used as a generator .

API documentation


list=allpages (ap)

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

Enumerate all pages sequentially in a given namespace.

Parameters:
apfrom

The page title to start enumerating from.

apcontinue

When more results are available, use this to continue.

apto

The page title to stop enumerating at.

apprefix

Search for all page titles that begin with this value.

apnamespace

The namespace to enumerate.

One of the following values: 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
apfilterredir

Which pages to list.

Note: Due to miser mode, using this may result in fewer than aplimit results returned before continuing; in extreme cases, zero results may be returned.

One of the following values: all, redirects, nonredirects
Default: all
apminsize

Limit to pages with at least this many bytes.

Type: integer
apmaxsize

Limit to pages with at most this many bytes.

Type: integer
apprtype

Limit to protected pages only.

Values (separate with | or alternative): edit, move, upload
apprlevel

Filter protections based on protection level (must be used with apprtype= parameter).

Values (separate with | or alternative): Can be empty, or autoconfirmed, sysop
apprfiltercascade

Filter protections based on cascadingness (ignored when apprtype isn't set).

One of the following values: cascading, noncascading, all
Default: all
aplimit

How many total pages to return.

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

The direction in which to list.

One of the following values: ascending, descending
Default: ascending
apfilterlanglinks

Filter based on whether a page has langlinks. Note that this may not consider langlinks added by extensions.

One of the following values: withlanglinks, withoutlanglinks, all
Default: all
apprexpiry

Which protection expiry to filter the page on:

indefinite
Get only pages with indefinite protection expiry.
definite
Get only pages with a definite (specific) protection expiry.
all
Get pages with any protections expiry.
One of the following values: indefinite, definite, all
Default: all

Example

GET request

Get all pages whose title contains the text "Jungle," in whole or part.

Response

Items in the results are listed in alphabetical order, by page title.
{
    "batchcomplete": "",
    "continue": {
        "apcontinue": "Jungle_(Bakufu_Slump_album)",
        "continue": "-||"
    },
    "query": {
        "allpages": [
            {
                "pageid": 341265,
                "ns": 0,
                "title": "Jungle"
            },
            {
                "pageid": 56461312,
                "ns": 0,
                "title": "Jungle-runner"
            },
            {
                "pageid": 18698572,
                "ns": 0,
                "title": "Jungle/Drum n bass"
            },
            {
                "pageid": 1487899,
                "ns": 0,
                "title": "Jungle2jungle"
            },
            {
                "pageid": 30391179,
                "ns": 0,
                "title": "JunglePup"
            }
            ...
        ]
    }
}

Sample code

get_allpages.py

#!/usr/bin/python3

"""
    get_allpages.py

    MediaWiki Action API Code Samples
    Demo of `Allpages` module: Get all pages whose title contains
    the text "Jungle," in whole or part.

    MIT License
"""

import requests

S = requests.Session()

URL = "https://en.wikipedia.org/w/api.php"

PARAMS = {
    "action": "query",
    "format": "json",
    "list": "allpages",
    "apfrom": "jungle"
}

R = S.get(url=URL, params=PARAMS)
DATA = R.json()

print(DATA)

Possible errors

Code Info
invalidparammix The prlevel parameter may only be used with prtype.

See also