How do I find the complete list of properties/fields that a given Rest API will return, resp. query parameters it will accept?

  Kiến thức lập trình

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:

fields provided by API in example vs. in real-world query

So it appears that neither is a subset of the other:

  1. Why isn’t the list of fields in the example complete?

  2. Else, how is one supposed to know which fields can be queried and which parameters can be submitted with the query?

LEAVE A COMMENT