Template:APIQuery categorymembers/doc
Note: Most of these are named after the parameters in the URL. Not all URL parameters are supported.
| This is a documentation subpage for Template:APIQuery categorymembers. It may contain usage information, categories and other content that is not part of the original template page. |
Usage
- Intended use
- Place this on a category page to generate a link to call the Wikipedia API to generate a list of pages in the category, limited to 500 results.
- Other uses
- Use this on any page to see the number of items in a category of the same name. This is potentially useful on article talk pages which have a category with an identical name.
- Use this with the
|CATPAGE=parameter to generate a link for a specific category.
- Use this at Special:ExpandTemplates. Put the category name in the
Context title, for Template:APIQuery categorymembers/doc, etc.:line and {{APIQuery categorymembers}} with the appropriate parameters in theInput wikitext:line.
- Use this multiple times with different parameters, to generate a list or table of links.
Parameters
Note: Most of these are named after the parameters in the URL. Not all URL parameters are supported.
|CATPAGE=- overrides the {{PAGENAME}} magic word.|cmprop=- default is|cmprop=title. To add timestamps, use|cmprop=title{{!}}timestamp.|cmnamespace=- default is blank. To filter the results by namespace provide the number of the namespace, e.g. 0 (article), 1 (talk), etc. A full list is at Wikipedia:Namespace.|format=- Default is xml. Other formats supported by the query API are supported.|cmsort=- Default is no sorting. use|cmsort=timestampto sort by time. See cmprop above.|cmdir=- Sorting direction, default is whatever the underlying API default is.|cmsort=descor|cmsort=asc.
- Example usage
- {{APIQuery categorymembers|cmnamespace=1}}
- generates a URL that will list articles in a category
- {{APIQuery categorymembers|cmnamespace=4|cmsort=timestamp|cmdir=desc|cmprop=title{{!}}timestamp}}
- generates a URL that will list the user talk pages in a category, sorted by date, descending, with dates
- {{APIQuery categorymembers|format=json}}
- generates a URL that will generate JSON-formatted output
- {{APIQuery categorymembers|cmnamespace=0|CATPAGE=Pages where post-expand include size is exceeded}}
- generates an unsorted list of article pages in Category:Pages where post-expand include size is exceeded:
//simple.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Pages_where_post-expand_include_size_is_exceeded&cmprop=title&cmlimit=500&cmnamespace=0&format=xml
Technical details
This template generates a "plain link" URL whose text is the namespace if the |csnamespace= parameter is used.
//en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category%3A{{{CATPAGE|{{PAGENAMEE}}}}}&cmprop={{{cmprop|title}}}&cmlimit=500&cmnamespace={{{cmnamespace|}}}&format={{{format|xml}}}{{#if: {{{cmsort|}}}|&cmsort={{{cmsort}}}}}{{#if: {{{cmdir|}}}|&cmdir={{{cmdir}}}
Related templates
- Template:APIQuery categorymembers/row - creates a single row. Example:
- User, (recent), User talk, (recent)
- This example lists
User:andUser talk:pages in Category:Pages where post-expand include size is exceeded
- Template:APIQuery categorymembers/table - Table of all namespaces, using Template:APIQuery categorymembers/row
See also
- Special:TrackingCategories - a list of Wikipedia maintenance categories. This template may be useful in some of these categories.
- mw:API:Categorymembers API details (on MediaWiki)
- Help:Searching#incategory: Using the search box to find pages in a category, can be combined with other search features like namespace selection
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.