Snap store API

I need a way to query the snap store (from a cloud lamba function) for information about installed snaps on a number of gateways. I have the aggregated list of snaps, and would need to check if there are new versions and possibly if there has been reported vulnerabilities.

UPDATE…
https://api.snapcraft.io looks promising, but I get a 404 “X-Ubuntu-Series header is required.” error

Any ideas?

Hello,

Why do you need this? If you own the gateways and the snaps, the store does send you an e-mail if your snaps contain packages for which there have been security fixes, so you can then rebuild the snaps. The devices will update automatically to new snap releases.

Can you detail your needs a bit more?

  • Daniel

Thanks for the reply Daniel,

We need to manage the life-cycle of the snaps outside the default auto-update service. The reason being we need to control when updates are done. With the current setup, we can only set daily timespans for when to prevent updates or disable it completely. This has left us to disable the update service.

After playing around I found this api to work:
https://api.snapcraft.io/api/v1/snaps/details/SNAP?channel=stable

But I can’t find any documentation :frowning:

However…I’d still like to automate the process of identifying vulnerabilities…

Got it, so if you have a specific list of snaps for which you want information, you can use:

https://api.snapcraft.io/docs/info.html

Give it a try.

  • Daniel
1 Like

Brilliant!
Thanks Daniel

BTW… any idea where I can find vulnerabilities?

Not a problem! Hey, would you mind sharing the list of snaps with me, or telling me which brand store they are in? The info API is really meant for use by snapd clients only, so we want to monitor and ensure that usage for your snaps is consistent with the API’s design parameters.

  • Daniel

Our intent was to call the API once a day using an aggregated list (not one per gateway). I would have been happy to do this from the gateway, provided I could get the response in a json format. But as of what I can see, the only way to get version info from the gateway would be using the >snap info snamname command, but it’s not useful as it would net be reliable to parse.

I don’t want to exhaust your api, so please let me know it you have some other suggestions :wink:

>$ snap list
Name                  Version               Rev   Tracking  Publisher    Notes
alsa-utils            1.1.2-5               68    stable    canonical✓   -
bluez                 5.47-3                166   stable    canonical✓   -
caracalla             16.04-1.38            52    stable    canonical✓   gadget
caracalla-kernel      4.4.0-157.185         113   stable    canonical✓   kernel
ccm-wda               3.01.14.42204         20    -         dell-inc     -
core                  16-2.39.3             7270  stable    canonical✓   core
core18                20190723              1074  stable    canonical✓   base
dcc                   3.2.1.283             3     -         dell-inc     -
dcm                   9.2.1.52              7     -         dell-inc     -
dell-managed-refresh  1.0                   2     stable    dell-inc     -
locationd             4.2.1                 163   stable    canonical✓   -
modem-manager         1.8.0-10              267   stable    canonical✓   -
network-manager       1.2.2-22              379   stable    canonical✓   -
ntpcontrol            0.1                   13    edge      ogra         -
snappy-debug          0.34-snapd2.39.3+git  383   stable    canonical✓   -
snapweb               0.26-11               319   stable    canonical✓   -
tpm2                  1.0-5                 42    stable    canonical✓   -
udisks2               2.6.4-2               100   stable    canonical✓   -
uefi-fw-tools         1.5.4-0.7.2+git       14    stable    canonical✓   -
ufw                   0.36                  296   stable    canonical✓   -
wifi-ap               25                    303   stable    canonical✓   -
wpa-supplicant        2.4.4                 53    stable    canonical✓   -```