New swift.org API endpoint for the current swiftly release

Hello All,

Swiftly is working towards the goal of making it into an offering available on swift.org for the 0.4.0 release. Eventually, it will be published there, with instructions to help people get it installed. Swiftly has a self-update mechanism to make it easy to keep up-to-date after the initial installation. In order to accomplish that it needs a way to call home to check whether an update is available and find the download that suits the current environment. There needs to be a swift.org API that can provide it with the necessary information.

I've drafted a proposed API endpoint and structure that I think can work, and is similar in certain ways to the existing endpoints for the toolchain releases, and developer snapshots. I hope to have your feedback.

The endpoint would be made available here: https://www.swift.org/api/v1/swiftly.json

Here is an example response:

{
    "version": "0.4.0",
    "platforms": [
        {
            "platform": "Darwin",
            "x86_64": "https://download.swift.org/swiftly-darwin-0.4.0.pkg",
            "arm64": "https://download.swift.org/swiftly-darwin-0.4.0.pkg"
        },
        {
            "platform": "Linux",
            "x86_64": "https://download.swift.org/swiftly-linux-x86_64-0.4.0.tar.gz",
            "arm64": "https://download.swift.org/swiftly-linux-arm64-0.4.0.tar.gz"
        }
    ]
}

The version will be the latest swiftly version number, which follows the semantic versioning numbering. The list of platforms divides the supported OS, reported by uname -s. For each processor architecture, either x86_64 or arm64, the value is the download URL for that OS and architecture. Note that the example download URL's here are fictitious, and may be changed by swift.org to suit its deployment at any time.

Since it's unlikely that users will want to keep an old version of swiftly around this response only needs to have information about the latest that is available.

Thanks,
Chris

7 Likes