PecanProject / bety

Web-interface to the Biofuel Ecophysiological Traits and Yields Database (used by PEcAn and TERRA REF)
https://www.betydb.org
BSD 3-Clause "New" or "Revised" License
16 stars 38 forks source link

provide list of available paths at /api/beta #429

Closed dlebauer closed 8 years ago

dlebauer commented 8 years ago

Currently, https://www.betydb.org/api/beta returns

{
  "metadata": {
    "URI": "https://www.betydb.org/api/beta",
    "timestamp": "2016-07-12T21:12:34-05:00"
  },
  "errors": "There is no resource at this URL.  Visit https://www.betydb.org/apipie for information about available API paths."
}

but, 1) https://www.betydb.org/apipie does not exist and 2) we should provide a list of available endpoints as a json object. Similar to this version of USDA Plants

gsrohde commented 8 years ago

https://www.betydb.org/api/docs is the "official" location of the BETYdb API documentation, and https://www.betydb.org/api/docs/beta is the location of the documentation of the beta version (which is currently the only version, not counting the "old" API).

Requests to any unrecognized path under https://www.betydb.org/api (including https://www.betydb.org/api/beta) will now redirect to https://www.betydb.org/api/docs. If you are using curl, you have to use the -L option to get the redirect to happen.

curl "https://www.betydb.org/api/docs" will return the documentation in JSON format. Visiting "https://www.betydb.org/api/docs" in a browser will return it in HTML format; to view it in a browser in JSON format, visit "https://www.betydb.org/api/docs.json".