API:Allfileusages
| This page is part of the MediaWiki action API documentation. |
MediaWiki action API
- Introduction and quick start
- FAQ
- Formats
- Error reporting
- Restricting usage
- Cross-site requests
- Authentication
- Queries
- Searching (by title, content, coordinates...)
- Parsing wikitext and expanding templates
- Purging pages' caches
- Parameter information
- Changing wiki content
- Create and edit pages
- Move pages
- Merge pages
- Rollback
- Delete pages
- Restore deleted revisions
- (Un)protect pages
- (Un)block users
- (Un)watch pages
- Mark revisions of watched pages as visited
- Send email
- Patrol changes
- Import pages
- Change user group membership
- Upload files
- User options
- Tokens
- Page language
- More...
- Watchlist feed
- Wikidata
- Extensions
- Using the API in MediaWiki and extensions
- Miscellaneous
- Implementation
- Client code
- Asserting
| Allfileusages | ||
|---|---|---|
This module can be used as a Generator. |
||
| Prefix | af | |
| Required rights | none | |
| Post only? | No | |
| Generated help | Current | |
| Version added |
|
|
List all file usages, including non-existing
Parameters[edit]
afcontinue: When more results are available, use this to continueaffrom: The title of the file to start enumerating fromafto: The title of the file to stop enumerating atafprefix: Search for all file titles that begin with this valueafunique: Only show distinct file titles. Cannot be used withafprop=ids. When used as a generator, yields target pages instead of source pages.afprop: What pieces of information to include (Default:title)ids: Adds the pageid of the using page (cannot be used withafunique)title: Adds the title of the file.
aflimit: How many total items to return. No more than 500 (5000 for bots) allowed. (Default: 10)afdir: The direction in which to list Possible values:ascending,descending. (Default:ascending)
Example[edit]
List the first 10 used files starting with the word "Icon" and what page ids they're used on
| Result |
|---|
<?xml version="1.0"?>
<api>
<query-continue>
<allfileusages afcontinue="Icon-C4004.jpg|8382176" />
</query-continue>
<query>
<allfileusages>
<f fromid="12221220" ns="6" title="File:Icon" />
<f fromid="12274856" ns="6" title="File:Icon" />
<f fromid="14729339" ns="6" title="File:Icon" />
<f fromid="20131921" ns="6" title="File:Icon" />
<f fromid="3683036" ns="6" title="File:Icon-C4004.jpg" />
<f fromid="3717526" ns="6" title="File:Icon-C4004.jpg" />
<f fromid="4802090" ns="6" title="File:Icon-C4004.jpg" />
<f fromid="7174658" ns="6" title="File:Icon-C4004.jpg" />
<f fromid="8315758" ns="6" title="File:Icon-C4004.jpg" />
<f fromid="8381624" ns="6" title="File:Icon-C4004.jpg" />
</allfileusages>
</query>
</api>
|
| The following documentation is the output of Special:ApiHelp/query+allfileusages, automatically generated by the pre-release version of MediaWiki that is running on this site (MediaWiki.org). |
list=allfileusages (af)
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0+
List all file usages, including non-existing.
Parameters:
- afcontinue
When more results are available, use this to continue.
- affrom
The title of the file to start enumerating from.
- afto
The title of the file to stop enumerating at.
- afprefix
Search for all file titles that begin with this value.
- afunique
Only show distinct file titles. Cannot be used with afprop=ids.
When used as a generator, yields target pages instead of source pages.
- Type: boolean (details)
- afprop
Which pieces of information to include:
- ids
- Adds the page IDs of the using pages (cannot be used with afunique).
- title
- Adds the title of the file.
- Values (separate with | or alternative): ids, title
- Default: title
- aflimit
How many total items to return.
- No more than 500 (5,000 for bots) allowed.
- Type: integer or max
- Default: 10
- afdir
The direction in which to list.
- One of the following values: ascending, descending
- Default: ascending
Examples:
- List file titles, including missing ones, with page IDs they are from, starting at B.
- api.php?action=query&list=allfileusages&affrom=B&afprop=ids|title [open in sandbox]
- List unique file titles.
- api.php?action=query&list=allfileusages&afunique=&affrom=B [open in sandbox]
- Gets all file titles, marking the missing ones.
- api.php?action=query&generator=allfileusages&gafunique=&gaffrom=B [open in sandbox]
- Gets pages containing the files.
- api.php?action=query&generator=allfileusages&gaffrom=B [open in sandbox]