API:Alltransclusions - MediaWiki (original) (raw)
Languages:
- Deutsch
- English
- Türkçe
- Zazaki
- español
- français
- polski
- čeština
- русский
- українська
- العربية
- हिन्दी
- বাংলা
- ไทย
- 中文
- 日本語
| This page is part of the MediaWiki Action API documentation. |
|---|
| MediaWiki version: | ≥ 1.21 |
|---|
GET request to list all existing and non-existing transclusions .
This module can be used as a generator .
| The following documentation is the output of Special:ApiHelp/query+alltransclusions, automatically generated by the pre-release version of MediaWiki that is running on this site (MediaWiki.org). |
|---|
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0-or-later
List all transclusions (pages embedded using {{x}}), including non-existing.
Specific parameters:
atcontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
atfrom
The title of the transclusion to start enumerating from.
atto
The title of the transclusion to stop enumerating at.
atprefix
Search for all transcluded titles that begin with this value.
atunique
Only show distinct transcluded titles. Cannot be used with atprop=ids.
When used as a generator, yields target pages instead of source pages.
Type: boolean (details)
atprop
Which pieces of information to include:
ids
Adds the page ID of the transcluding page (cannot be used with atunique).
title
Adds the title of the transclusion.
Values (separate with | or alternative): ids, title
Default: title
atnamespace
The namespace to enumerate.
One of the following values: -1, -2, 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, 710, 711, 828, 829, 1198, 1199, 1728, 1729, 2600, 5500, 5501
Default: 10
atlimit
How many total items to return.
Type: integer or max
The value must be between 1 and 500.
Default: 10
atdir
The direction in which to list.
One of the following values: ascending, descending
Default: ascending
Get three unique pages in the main namespace which contain transclusions.
{ "batchcomplete": "", "continue": { "atcontinue": "!Hero_(album)", "continue": "-||" }, "query": { "alltransclusions": [ { "ns": 0, "title": "!!Destroy-Oh-Boy!!" }, { "ns": 0, "title": "!Action Pact!" }, { "ns": 0, "title": "!Arriba!" } ] } }
#!/usr/bin/python3
""" get_alltransclusions.py
MediaWiki API Demos
Demo of `Alltransclusions` module: Get three unique pages in the main
namespace which contain transclusions.
MIT License"""
import requests
S = requests.Session()
URL = "https://en.wikipedia.org/w/api.php"
PARAMS = { "action": "query", "format": "json", "list": "alltransclusions", "atunique": "1", "atnamespace": "0", "atlimit": "3" }
R = S.get(url=URL, params=PARAMS) DATA = R.json()
TRANSCLUSIONS = DATA["query"]["alltransclusions"]
for t in TRANSCLUSIONS: print(t["title"])
"query", "format" => "json", "list" => "alltransclusions", "atunique" => "1", "atnamespace" => "0", "atlimit" => "3" ]; url=url = url=endPoint . "?" . http_build_query( $params ); ch=curlinit(ch = curl_init( ch=curlinit(url ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); output=curlexec(output = curl_exec( output=curlexec(ch ); curl_close( $ch ); result=jsondecode(result = json_decode( result=jsondecode(output, true ); foreach( result["query"]["alltransclusions"]asresult["query"]["alltransclusions"] as result["query"]["alltransclusions"]ask => $v ) { echo( $v["title"] . "\n" ); } /* get_alltransclusions.js MediaWiki API Demos Demo of `Alltransclusions` module: Get three unique pages in the main namespace which contain transclusions. MIT License */ var url = "https://en.wikipedia.org/w/api.php"; var params = { action: "query", format: "json", list: "alltransclusions", atunique: "1", atnamespace: "0", atlimit: "3" }; url = url + "?origin=*"; Object.keys(params).forEach(function(key){url += "&" + key + "=" + params[key];}); fetch(url) .then(function(response){return response.json();}) .then(function(response) { var transclusions = response.query.alltransclusions; for (var t in transclusions) { console.log(transclusions[t].title); } }) .catch(function(error){console.log(error);}); /* get_alltransclusions.js MediaWiki API Demos Demo of `Alltransclusions` module: Get three unique pages in the main namespace which contain transclusions. MIT License */ var params = { action: 'query', format: 'json', list: 'alltransclusions', atunique: '1', atnamespace: '0', atlimit: '3' }, api = new mw.Api(); api.get( params ).done( function ( data ) { var transclusions = data.query.alltransclusions, t; for ( t in transclusions ) { console.log( transclusions[ t ].title ); } } ); | Code | Info | | -------------------- | -------------------------------------------------------------------------------------------------------------- | | unknown\_atnamespace | Unrecognized value for parameter **atnamespace**: **value**.Results from enumerating a non-existent namespace. | * This module is part of [API:Alllinks](/wiki/Special:MyLanguage/API:Alllinks "Special:MyLanguage/API:Alllinks")[ ](/wiki/API:Alllinks "API:Alllinks"). * [API:Templates](/wiki/Special:MyLanguage/API:Templates "Special:MyLanguage/API:Templates")[ ](/wiki/API:Templates "API:Templates") – Gets a list of all pages transcluded in a page.