Add versions.json endpoint with latest release information - Mailing list pgsql-www

From Sehrope Sarkuni
Subject Add versions.json endpoint with latest release information
Date
Msg-id CAH7T-arRnBT4YGoJs__ANNDhr1TSowv-o-bTq84-B=H_D77Oww@mail.gmail.com
Whole thread Raw
Responses Re: Add versions.json endpoint with latest release information
List pgsql-www
Hello,

The attached patch adds a /versions.json endpoint with the latest release information. The response is a machine parseable JSON array with one entry per release.

For simplicity the patch keeps the same field names in the response as the django model. Someone else with more familiarity with django may want to change that (tree => major?).

Sample output:

[
  {
    "tree": "8.0",
    "latestminor": 21,
    "reldate": "2009-03-17",
    "current": false,
    "supported": true,
    "eoldate": "2010-10-01"
  },
  {
    "tree": "8.1",
    "latestminor": 17,
    "reldate": "2009-03-17",
    "current": false,
    "supported": true,
    "eoldate": "2010-11-01"
  },
  // ... truncated ...
  {
    "tree": "8.4",
    "latestminor": 0,
    "reldate": "2009-07-01",
    "current": false,
    "supported": true,
    "eoldate": "2014-07-01"
  }
]
The use case is for automatically determining the latest and greatest PG versions via simple scripting:

$ curl -s http://www.postgresql.org/versions.json | jq 'last'
{
  "tree": "8.4",
  "latestminor": 0,
  "reldate": "2009-07-01",
  "current": false,
  "supported": true,
  "eoldate": "2014-07-01"
}

Regards,
-- Sehrope Sarkuni
Founder & CEO | JackDB, Inc. | https://www.jackdb.com/

Attachment

pgsql-www by date:

Previous
From: David Turoň
Date:
Subject: Wiki editor request
Next
From: Ilaria
Date:
Subject: Google Summer of Code 2021 - last call for mentors