Screenshots are going away

In snapd's JSON response to /v2/find requests, up to 2.36, screenshots were in a list under the "screenshots" key of the toplevel "result":

"screenshots" : [
   {
      "url" : "https://example.com/screenshot.cgm"
   }
],

As of 2.36, screenshots should instead be taken from the "media" element:

"media" : [
   {
      "type" : "icon",
      "url" : "https://example.com/icon.cgm"
   },
   {
      "url" : "https://example.com/screenshot.cgm",
      "type" : "screenshot"
   }
],

The "screenshots" element is now deprecated [once 2.36 hits stable], and will be removed in 2.39 2.40.
We are including a deprecation notice in the JSON as well, for ease of discover. If you reached this topic from that note, welcome!

The exact version in which we do the removal is awaiting confirmation from stakeholders; this topic will be updated once we’ve agreed it.

1 Like

I suspect this is some API change in snapd and nothing related to not having screenshots on the Snap Store API itself and the store front it serves?

Yes.

A reminder that the above is happening.

1 Like

we’ve pushed the dropping of screenshots to 2.40 to accommodate some of our clients not being ready just quite yet.

2 Likes

Trolling thread title

2 Likes

The deprecation notice, i.e.

"screenshots": [
  {
    "note": "'screenshots' is deprecated; use 'media' instead. More info at https://forum.snapcraft.io/t/8086"
  }
],

turned out to trigger a bug in snapd-glib in that it would interpret that as one screenshot but with no URL. The simplest solution was just to make snapd-glib stop parsing screenshots. I’d recommend now media is fully established to just stop setting screenshots entirely (it’s set to omitempty so clients should accept it not present).

This bug was noticed in GNOME Software for snaps that had no screenshots at all - we checked media and then checked screenshots as the first had no elements.

Proposed removal of deprecation notice in https://github.com/snapcore/snapd/pull/7893