Public Store API?

Hi there,

I’m just curious if there is a public API that people can leverage to maybe perform searches, installs, etc (if say one was so inclined to leverage on a desktop app). Generally what the snap command does.

I have read references to the store API but had not yet found the documentation through google searches, or on docs.snapcraft.io.

I assume it exists since https://uappexplorer.com/snaps is performing similar functions, and found references to https://search.apps.ubuntu.com/

I was just curious as to what this API may look like, etc.

Thank you.

1 Like

Annndddd right after I posted this, I found a link in the https://uappexplorer.com/snaps site…

This then links over to https://dashboard.snapcraft.io/docs/ - So I think I am on the right path now…

For use on the device, you are best off interacting with snapd via its own API: https://docs.ubuntu.com/core/en/reference/rest

As @noise said, you can use snapd’s API directly if you want. If you want to tinker, you can use curl and jq directly,

or you can use the http snap, which packages httpie with the unix socket connector and some code to handle snapd:// urls :slight_smile:

Additionally I’d recommend, if you’re tinkering with snapd, that you set SNAPD_DEBUG=1 and SNAPD_DEBUG_HTTP=3 either in /etc/environment, or dropping a systemd snippet in /etc/systemd/system/snapd.service.d/.

HTH, HAND.

2 Likes

In the docs, one of the first things is states is:

“You can interface with snapd on any Ubuntu Core system using its REST API.”

When they are “core” - does this also include a traditional Ubuntu install?

Thank you.

EDIT - I beleive this will work for any Ubuntu system as the curl -sS --unix-socket /run/snapd.socket http://localhost/v2/system-info | jq seems to work without issue.

That’s just outdated text in that doc, we’ll get that cleaned up.

1 Like

Note that the Store API documentation seems to be available at Snapstore Devices API Documentation | Snapstore Devices API Documentation: version 24.

This allows to query snap info without the snapd dependency.