When calling the Wikipedia API, what do the keys in the links objects mean?
ns
stands for namespace, but why is it an integer?exists
empty for every object?*
?For example, calling:
https://en.wikipedia.org/w/api.php?action=parse&page=List_of_cognitive_biases&prop=links
Response:
{
"parse": {
"title": "List of cognitive biases",
"pageid": 510791,
"links": [{
"ns": 0,
"exists": "",
"*": "Anthropomorphism"
}, {
"ns": 0,
"exists": "",
"*": "Apophenia"
},
...
]
}
}
You are right, the ns
stands for namespace, and the all "35 namespaces in Wikipedia are numbered for programming purposes...".
The empty exists means that the link to this page is available in Wikipedia. If the link doesn't exist (it is a redlink), this line will missing (example with Wikipedia:Most-wanted articles).
By the way you can get the same but more compact result by using action query:
https://en.wikipedia.org/w/api.php?action=query&titles=List_of_cognitive_biases&prop=links&pllimit=500
For your example the result will be:
"links": [
{
"ns": 0,
"title": "Anthropomorphism"
},{
"ns": 0,
"title": "Apophenia"
},
...
]