w3c / w3c-api

The W3C API
https://w3c.github.io/w3c-api/
214 stars 92 forks source link

Improving /specifications #92

Closed plehegar closed 3 days ago

plehegar commented 5 years ago

For all specifications, I find myself systematically accessing the latest-version/status in order to:

  1. eliminate retired specifications from the lists
  2. display the status of a specification

This generates a lot of subsequent API calls.

is it possible to expose specification/latest-version/status directly as specification/status, and have a way to only retrieve active specifications?

vivienlacourba commented 5 years ago

Hi @plehegar,

You can get this info using a single API call (modulo the pagination for long results) from: https://api.w3.org/specifications?embed=1

From that list you will have the status of the latest version of each specification (each specification status can be seen in the title attribute of thelatest-version link ).

Below an extract from the above API call result showing one specification (ATAG10) with the Recommendation status and one (becss) with the Retired status.

{
  "page": 1,
  "limit": 100,
  "pages": 14,
  "total": 1326,
  (...)
  "_embedded": {
    "specifications": [
      {
        "shortlink": "http://www.w3.org/TR/ATAG10/",
        "title": "Authoring Tool Accessibility Guidelines 1.0",
        "shortname": "ATAG10",
        (...)
        "_links": {
          (...)
          "latest-version": {
            "href": "https://api.w3.org/specifications/ATAG10/versions/20000203",
            "title": "Recommendation"
          }
        }
      },
      (...)
      {
        "shortlink": "http://www.w3.org/TR/becss/",
        "title": "Behavioral Extensions to CSS",
        "shortname": "becss",
        (...)
        "_links": {
          (...)
          "latest-version": {
            "href": "https://api.w3.org/specifications/becss/versions/20141014",
            "title": "Retired"
          }
        }
      },
      (...)
    ]
  }
}

For all specifications, I find myself systematically accessing the latest-version/status in order to:

  1. eliminate retired specifications from the lists

Unfortunately with the current W3C API code it is not possible to filter on the server side the results to omit the specifications with a Retired status (see #76).