1. Home
  2. Docs
  3. Developer’s Guide
  4. GUARDARA API

GUARDARA API

The GUARDARA Python API will allow to perform all the actions that are available via the user interface straight from Python. Behind the scenes the Python API performs calls to the API exposed by the GUARDARA Manager over HTTPS.

Installing the SDK

The Python API library is part of the GUARDARA SDK. The SDK can be downloaded from the Settings > Developers page of GUARDARA Manager. Visit the relevant section of the Extensions and the SDK page for more information.

API Access Setup

To access the API, users have to set up an API key via the API Keys tab of the Settings page. To create a new API key, click on the + icon on the top-left corner of the screen.

As can be seen in the screenshot below, users can set up an API key by providing a name for the API key and selecting one or more Scopes. Scopes define what actions can be performed using an API key.

Only Scopes that were assigned to the user’s account can be granted to API keys. This means, for example, if a user has been only authorized to obtain a list of engines (engine:read scope), the Scope list on the API key form will only show a single Scope item being assignable to the API key.

Once an API key is created, the API Key and the API Secret will be presented to the user, as shown below.

Authentication

Each API request is authenticated. Successful authentication requires both the API key and API secret to be passed as HTTP request headers. An example request using curl can be seen below.

curl 'https://127.0.0.1:8443/api/unit/unit/b3eb91d7-88c2-4140-97cf-0bb5cac7b0b5' \
    -H 'x-api-key: f38e6086-5a38-4b9d-9e61-39258f2e47f7' \
    -H 'x-api-secret: 51924c7283d4fe39031811df20e1342528181517787927a86eb1f8d2ca623dc7' \
    -H 'Connection: keep-alive'

Using the API

The GUARDARA API section of the README.md file within the SDK contains all the information required to get started with the Python API. Make sure to also take a look at the examples provided under the examples directory.

Was this article helpful to you? Yes No