API:Allimages
From MediaWiki.org
| This page is part of the MediaWiki action API documentation. |
MediaWiki action API
- Introduction and quick start
- FAQ
- Tutorial
- 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
- Watchlist feed
- Wikidata
- Extensions
- Using the API in MediaWiki and extensions
- Miscellaneous
- Implementation
- Client code
- Asserting
| Allimages | ||
|---|---|---|
| Prefix | ai | |
| Required rights | none | |
| Post only? | No | |
| Generated help | Current | |
| Version added |
|
|
Returns a list of all images, ordered by image title or by timestamp. Timestamp order was added in MediaWiki 1.20. Only the most recent version of each image is returned.
Parameters[edit | edit source]
aisort: Property to sort by (Default:name) 1.20+name: Sort results by nametimestamp: Sort results by timestamp
aidir: In which direction to list (Default:ascending)ascending: List from A to Z (when aisort=name) or from old to new (when aisort=timestamp)descending: List from Z to A (when aisort=name) or from new to old (when aisort=timestamp)newer: List from A to Z (when aisort=name) or from old to new (when aisort=timestamp) 1.20+older: List from Z to A (when aisort=name) or from new to old (when aisort=timestamp) 1.20+
aifrom: Start listing at this title. The title doesn't need to exist. Can only be used with aisort=nameaito: Stop listing at this title. The title doesn't need to exist. Can only be used with aisort=nameaiprefix: Only list titles that start with this value. Can only be used with aisort=nameaistart: The timestamp to start enumerating from. Can only be used with aisort=timestamp 1.20+aiend: The timestamp to end enumerating. Can only be used with aisort=timestamp 1.20+aiminsize: Only list images that are at least this many bytes in sizeaimaxsize: Only list images that are at most this many bytes in sizeailimit: Maximum amount of images to list (Default: 10)aisha1: Only list images with this SHA-1 hash. These hashes are supposed to be unique, so you can use this to track duplicates. If you run into two different images with the same hash, you should start playing the lotteryaisha1base36: Same asaisha1, but in base 36aiuser: Only return files uploaded by this user. Can only be used with aisort=timestamp. Cannot be used together with aifilterbots 1.20+aifilterbots: How to filter files uploaded by bots. Can only be used with aisort=timestamp. Cannot be used together with aiuser. Possible values:all,bots,nobots. 1.20+aiprop: Which properties to get (Default:timestamp|url)timestamp: The time and date the most recent version of the image was uploadeduser: The name of the user who uploaded the most recent versionuserid: Add the user ID that uploaded the image version 1.17+comment: The edit comment for the latest uploadparsedcomment: Parse the comment on the version 1.17+canonicaltitle: Adds the canonical title of the image file 1.23+url: The URL to the most recent version of the imagesize: The image's size in bytes, its height and its width. Page count and duration are added if applicabledimensions: Alias forsizesha1: The image's SHA-1 hashmime: The image's MIME typemediatype: The media type of the image 1.18+metadata: Exif metadata for the version of the imagecommonmetadata: File format generic metadata for the version of the image 1.23+extmetadata: Formatted metadata combined from multiple sources. Results are HTML formatted. 1.23+bitdepth: The bit depth of the version 1.14+
aimime: What MIME type to search for. e.g. image/jpeg. Disabled in Miser Mode 1.18+
Example[edit | edit source]
Show a list of first 5 images whose name starts with "Albert"
api.php? action=query& list=allimages& ailimit=5& aifrom=Albert& aiprop=dimensions|mime [try in ApiSandbox]
| Result |
|---|
|
New (since 1.20 or maybe earlier):
<?xml version="1.0"?>
<api>
<query-continue>
<allimages aicontinue="Albert-ebenezer-fox.jpg" />
</query-continue>
<query>
<allimages>
<img name="Albert's_House.jpg" size="35521" width="400" height="388" mime="image/jpeg" ns="6" title="File:Albert's House.jpg" />
<img name="Albert-Pierrepoint.jpg" size="9407" width="238" height="204" mime="image/jpeg" ns="6" title="File:Albert-Pierrepoint.jpg" />
<img name="Albert-Sammons.jpg" size="45309" width="321" height="447" mime="image/jpeg" ns="6" title="File:Albert-Sammons.jpg" />
<img name="Albert-batel2.jpg" size="6922" width="163" height="198" mime="image/jpeg" ns="6" title="File:Albert-batel2.jpg" />
<img name="Albert-daly.jpg" size="643005" width="2016" height="1496" mime="image/jpeg" ns="6" title="File:Albert-daly.jpg" />
</allimages>
</query>
</api>
Old:
<?xml version="1.0" encoding="utf-8"?>
<api>
<query-continue>
<allimages aifrom="Albert-einstein-biography-pictures.jpg" />
</query-continue>
<query>
<allimages>
<img name="Albert's_Real_Jamaican_Foods.JPG" width="1024" height="768" mime="image/jpeg" />
<img name="Albert-Cashier.jpg" width="150" height="220" mime="image/jpeg" />
<img name="Albert-Park-Brisbane-1.jpg" width="936" height="695" mime="image/jpeg" />
<img name="Albert-Park-Brisbane-2.jpg" width="830" height="525" mime="image/jpeg" />
<img name="Albert-Park-railway-station.jpg" width="640" height="480" mime="image/jpeg" />
</allimages>
</query>
</api>
|