In this question I’m giving the example of the Wikipedia REST API, but really I’d like to know the answer for any Rest API, as documentation for several APIs I have looked at so far present a similar problem:
Rather than just listing the parameters it will accept and the fields that a query can return, it’ll give examples with incomplete information.
For instance, The Rest API for the English Wikipeda is documented here (also its uri for queries):
To get the summary for a specific Wikipedia page, I would query this specific API:
https://en.wikipedia.org/api/rest_v1//page/summary/{title}
In the docs, this is the example schema:
{
"titles": {
"canonical": "string",
"normalized": "string",
"display": "string"
},
"pageid": 0,
"extract": "string",
"extract_html": "string",
"thumbnail": {
"source": "string",
"width": 0,
"height": 0
},
"originalimage": {
"source": "string",
"width": 0,
"height": 0
},
"lang": "en",
"dir": "ltr",
"timestamp": {},
"description": "American poet",
"coordinates": {
"lat": 0,
"lon": 0
}
}
When I query, for instance, the page for the list of turkish provinces using Powershell, the list of fields in the result is not identical to the example. Here’s a comparison:
So it appears that neither is a subset of the other:
-
Why isn’t the list of fields in the example complete?
-
Else, how is one supposed to know which fields can be queried and which parameters can be submitted with the query?