The Landscape API

Landscape’s API lets you perform many Landscape tasks from the command line or a shell script, or a Python module. You can also use the API in HTTPS calls.

The only means to install Landscape API is via snap:

sudo snap install landscape-api

Once the landscape-api command is installed you can get help on all Landscape API commands by typing:

landscape-api -h

Before you use Landscape API, you must retrieve your API credentials from the Landscape dashboard. Specifically, you will need to retrieve the API access key and API secret key. To do so, click on your account name in the upper right corner of the Landscape dashboard. The keys can be passed as command-line options, but it’s easier to export them as a shell variable with commands like:

export LANDSCAPE_API_KEY="{API access key}"
export LANDSCAPE_API_SECRET="{API secret key}"
export LANDSCAPE_API_URI="https://{landscape-hostname}/api/"

If you use a custom Certificate Authority (CA), you also need to export the path to your certificate:

export LANDSCAPE_API_SSL_CA_FILE="/path/to/ca/file"
1 Like

Why only means to install Landscape API is via snap? Can´t landscape-api to be added to the repos?

It is generally a massively higher developer effort to maintain a package through the repos (i.e. you will need to maintain four copies of it for four releases (3x currently supported LTS releases plus the current dev release) most likely all having different versions of your dependencies (i.e. different pyhton versions and other dependencies) while a snap has always only one set of dependencies and one python version you need to handle (and indeed all of them surfacing different types and sets of bugs).

To apply a fix across the board you also have a massively higher turnaround time via the SRU process, while a snap can simply use its channels to easily provide test versions or even different releases of the same software which you need to maintain exactly once.

so it is simply a cost question and if you want to invest such many extra developer hours.