F-Droid now provides JSON API

The API is accessible via https://f-droid.org/api.

For now only https://f-droid.org/api/v1/packages exists, which can be used to query information about the applications in the main repository. Archived applications can’t be accessed this way.

Example request:

GET https://f-droid.org/api/v1/packages/org.fdroid.fdroid HTTP/1.1

Example response:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
  "packageName": "org.fdroid.fdroid",
  "suggestedVersionCode": 1009000,
  "packages": [
    {
      "versionName": "1.10-alpha0",
      "versionCode": 1010000
    },
    {
      "versionName": "1.9",
      "versionCode": 1009000
    }
  ]
}

This API is already used by shields.io project to provide F-Droid badges, like this.

As you may notice, only a small amount of data may be retrieved from this API. That’s normal, because it was designed to be extendible. It might be possible to expand its functionality in the future if someone will be needed in more details.

You can always create an issue or open a merge request on F-Droid / Website GitLab project page, if you want to ask something or contribute.

4 Likes

Thanks again for putting this together! It is a good complement to the full index download. This opens up new possibilities like the badge this was written for. And now that we nailed down the method to generate it, it should be quite easy for contributors to expand upon it. See the merge request as an example: https://gitlab.com/fdroid/fdroid-website/-/merge_requests/568