API:Embeddedin/fr

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

Other languages:
English • ‎català • ‎dansk • ‎español • ‎français • ‎português • ‎română • ‎русский • ‎ไทย • ‎中文 • ‎日本語 • ‎한국어
Version de MediaWiki : 1.11

GET request to find all page(s) that embed a given page.

This module can be used as a generator .

API documentation




list=embeddedin (ei)

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

Find all pages that embed (transclude) the given title.

Parameters:
eititle

Title to search. Cannot be used together with eipageid.

eipageid

Page ID to search. Cannot be used together with eititle.

Type: integer
eicontinue

When more results are available, use this to continue.

einamespace

The namespace to enumerate.

Values (separate with | or alternative): 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
To specify all values, use *.
eidir

The direction in which to list.

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

How to filter for redirects.

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

How many total pages to return.

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

Exemple

GET request

Find all pages that embed the English Wikipedia's w:Computer page.

Response

{
    "batchcomplete": "",
    "query": {
        "embeddedin": [
            {
                "pageid": 14388072,
                "ns": 100,
                "title": "Portal:Computing"
            },
            {
                "pageid": 45719527,
                "ns": 2,
                "title": "User:SoSivr/sandbox"
            }
        ]
    }
}

Sample code

get_embedded_pages.py

#!/usr/bin/python3

"""
    get_embedded_pages.py

    MediaWiki Action API Code Samples
    Demo of `Embeddedin` module: Get all page(s) that 
    embed the given title.

    MIT License
"""

import requests

S = requests.Session()

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

PARAMS = {
    "action": "query",
    "format": "json",
    "list": "embeddedin",
    "eititle": "Computer",
    "eilimit": "20"
}

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

print(DATA)

Possible errors

Code Informations
missingparam Un des paramètres eititle, eipageid est obligatoire.
eibadcontinue Paramètre de continuation non valide. Vous devez passer la valeur d’origine renvoyée par la requête précédente.

See also