API availability seems limited

snap store status seems green, but I can’t seem to get consistent results from the API:

$ curl -H 'X-Ubuntu-Series: 18' 'https://api.snapcraft.io/api/v1/snaps/details/core18' | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1352  100  1352    0     0   2687      0 --:--:-- --:--:-- --:--:--  2682
{
  "aliases": null,
  "anon_download_url": "https://api.snapcraft.io/api/v1/snaps/download/CSO04Jhav2yK0uz97cr0ipQRyqg0qQL6_719.snap",
  "apps": [],
  "architecture": [
    "amd64"
  ],
  "binary_filesize": 56287232,
  "channel": "stable",
  "common_ids": [],
  "confinement": "strict",
  "contact": "",
  "content": "base",
  "date_published": "2018-04-04T08:34:18.781588Z",
  "deltas": [],
  "description": "The base snap based on the Ubuntu 18.04 release.",
  "developer_id": "canonical",
  "developer_name": "Canonical",
  "developer_validation": "verified",
  "download_sha3_384": "23ef78637ed53fb0fd97069935b914e485ce74ee7c14eeafa04793d9bab19fcdfe650a6229d008b28f25fbe5e9e53000",
  "download_sha512": "dfef3c215ae7b66c8db491e5797624b54a46e2e1bafb7ab4eb473bc854c70b06e31d57a35ef7522aeef622e296f6d666924bc3fdb5fe83e12fe24ef68dcccc88",
  "download_url": "https://api.snapcraft.io/api/v1/snaps/download/CSO04Jhav2yK0uz97cr0ipQRyqg0qQL6_719.snap",
  "epoch": "0",
  "gated_snap_ids": [],
  "icon_url": "",
  "last_updated": "2019-02-11T14:43:23.102310+00:00",
  "license": "Other Open Source",
  "name": "core18.canonical",
  "origin": "canonical",
  "package_name": "core18",
  "prices": {},
  "private": false,
  "publisher": "Canonical",
  "ratings_average": 0,
  "release": [
    "16"
  ],
  "revision": 719,
  "screenshot_urls": [],
  "snap_id": "CSO04Jhav2yK0uz97cr0ipQRyqg0qQL6",
  "summary": "Runtime environment based on Ubuntu 18.04",
  "support_url": "",
  "title": "Core 18",
  "version": "18",
  "website": ""
}

And then half a second later, the same command gives:

$ curl -H 'X-Ubuntu-Series: 18' 'https://api.snapcraft.io/api/v1/snaps/details/core18' | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   285  100   285    0     0    253      0  0:00:01  0:00:01 --:--:--   253
{
  "error_list": [
    {
      "code": "resource-not-found",
      "message": "Snap 'core18' (CSO04Jhav2yK0uz97cr0ipQRyqg0qQL6) has no published revisions in the given context."
    }
  ],
  "errors": [
    "Snap 'core18' (CSO04Jhav2yK0uz97cr0ipQRyqg0qQL6) has no published revisions in the given context."
  ],
  "result": "error"
}

What’s going on? It actually seems the majority of the time I get that error, and every once in a while it works. This seems to be the case regardless of the snap (I’ve tried several).

The core18 snap lives in the 16 snapd series, so your X-Ubuntu-Series header should be 16 rather than 18. The 18 series doesn’t exist and probably never will; snapd series are closer to an API version rather than directly matching each Ubuntu series.

Store APIs should be 404ing any non-16 requests, so I’ll investigate why the behaviour is inconsistent. But there’s no availability or reachability issue here, just inconsistent results for an unsupported request.

1 Like

Ah! Thank you, I just assumed that should be 18 if I was on bionic. Indeed, 16 seems to work consistently.

This is bug #1816215 (internal link, sorry).