API talk:Categorymembers
Namespace Property
editFor the cmnamespace property, does it take the namespace's number of its name? --(Havvy) 97.120.59.79 01:12, 17 September 2012 (UTC)
- It takes one or more numbers: for example,
cmnamespace=0|1|2|3
. --R'n'B (talk) 11:47, 18 September 2012 (UTC)
Typo in properties?
editI scratched my head on using this on Wikimedia Commons, but then found that properties such cmtype are actually named gcmtype. --Fæ (talk) 10:07, 27 August 2013 (UTC)
- This is standard for any property retrieved using "generator=foo" as opposed to "titles=foo|bar". See API:Query#Generators for details. --R'n'B (talk) 01:40, 3 September 2013 (UTC)
Commons: gcmprop
editThis seems to be stuck on default (ids|titles) and does not provide any other returns. Example where timestamp is a requested property but not returned. --Fæ (talk) 22:42, 28 August 2013 (UTC)
Wikiget
edit- Wikiget, a unix command-line tool to retrieve the list of articles in a category. -- Green Cardamom (talk) 01:49, 23 November 2016 (UTC)
Search a for a page title in a specific category.
editAre we able to query for a keyword under a given category? For example, I would like to query for space until the category keyboard.— Preceding unsigned comment added by 148.75.250.118 (talk • contribs) 21:53, 27 May 2017
Abnormal skip in TOC numbering (corrected)
edit2.1=>2.6 2.6=>2.11
1 API documentation 2 Examples 2.1 Example 1: List twenty pages in a category 2.1.1 GET request 2.1.2 Response 2.1.3 Sample code 2.6 Example 2: Get the ten articles most recently added to a category 2.6.1 GET request 2.6.2 Response 2.6.3 Sample code 2.11 Example 3: Get ten subcategories of a category 2.11.1 GET request 2.11.2 Response 2.11.3 Sample code 3 Possible errors 4 Parameter history 5 See also
refer to => https://www.mediawiki.org/wiki/Topic:V80j0jclibtkd7g4
What is the value for PARAM:"cmcontinue":
editI can put value for "cmlimit":50. For "cmcontinue":"?"--Info-farmer (talk) 05:31, 16 February 2020 (UTC)
- Whatever was returned in that parameter from the previous query that you are now continuing. --Clump (talk) 13:06, 16 February 2020 (UTC)
- I am using the sample code of get_category_items.py (API:Categorymembers#Example_1:_List_twenty_pages_in_a_category) and i changed the code as follows;-
PARAMS = { "action": "query", "cmtitle": "Category:Physics", "cmlimit": "20", "cmcontinue":"21", "list": "categorymembers", "format": "json" }
but i am getting the error:
"KeyError: 'query' "
how can i solve this issue?--Info-farmer (talk) 07:02, 17 February 2020 (UTC)
cmcontinue
is not a count. Observe that the original query includes in its json response a value forcmcontinue
. That exact value is the one you need to pass in thecmcontinue
parameter when making a subsequent query (to continue the query). --Clump (talk) 12:28, 17 February 2020 (UTC)- when i print "DATA = R.json()", i understand my mistake. Thanks indeed for your explanation.--Info-farmer (talk) 01:30, 18 February 2020 (UTC)
a better response schema
editIt would be better if the main response schema would look something like:
"query": {
"categorymembers": {
"<cmtitle/cmpageid>": [
...
]
}
}
Certain categories are timing out
editI have SPARQL code to generate Wikidata lists, and I've come across a few categories that are timing out the query, without any clear differences amognst them to justify it:
Versus working categories:
Exclude a category
editIs it possible to request pages that are members of a certain category BUT aren't members of another? 2800:810:49E:8CE3:1855:7B42:8E71:B741 17:58, 3 July 2024 (UTC)
Deepcategory members – how to include files in subcategories?
editSo mwapi:generator "categorymembers";
can be used to query for files/pages directly in a category but how to see files/pages directly in a category or any of its subcategories like it's possible with the deepcategory search operator on Commons? Prototyperspective (talk) 15:50, 26 November 2024 (UTC)