Axonius REST API and Python API Client
  • 28 Jul 2024
  • 3 Minutes to read
  • Dark
    Light
  • PDF

Axonius REST API and Python API Client

  • Dark
    Light
  • PDF

Article summary

Use the Axonius REST API to perform tasks within the Axonius platform instead of using the UI. Axonius provides two ways to access the Axonius REST API:

  • The regular REST API service
  • A Python-wrapped API client that allows you to use the Python programming language to run REST API commands. See here for more information on installing and using the API client.

To use either API, you must have the following:

  • API Key and API Secret
  • API Access permission: The user's role used to access the API requires that the API Access permission will be enabled.

REST API v2 Beta Release

Axonius is excited to announce the beta release of API v2 which will be available by default on all Axonius instances running version 6.1.24 and above. APIv2 is designed to enhance your REST API experience. This new version features a more intuitive interface with cleaner and more intuitive endpoints and simplified parameter names.

Key Features of API v2:

  • Streamlined Endpoints: The initial release includes around 40 endpoints, each focused on the most vital parameters needed to achieve your goals. More endpoints will be added over time.
  • Standardized and Developer-Friendly: The new API adheres to industry standards, making it easier to use and developer-friendly, which in turn speeds up development for Axonius developers.
  • Comprehensive Documentation: Our detailed and cohesive documentation helps users quickly understand which endpoints to use and how to write the necessary code to achieve their objectives.
  • Clear Error Messages: Clear and simple error messages, making it easier to understand and resolve issues.

Early Adoption Program
Interested in joining our Early Adoption Program? Open a Zendesk ticket and select the APIv2 option, to request access to the documentation.

Using User Accounts or Service Accounts to Access the API

The API can be accessed using any Axonius user account with a role that has the required permissions. Simply use the API Key and API Secret of your user account when sending API requests.

You can also create special Service Accounts to access the API instead of using a regular Axonius user account. These are Axonius accounts that only connect to the system using the API. Using Service Accounts is recommended. The API Key and API Secret for Service Accounts are found in the same place as any other user account. See Get an API Key and API Secret below.

Refer to Managing Service Accounts for more about Service Accounts.

Getting an API Key and API Secret

Using the Axonius API to query Axonius assets requires an API key and API secret.

To get an API Key and an API Secret do as follows:

  1. Log in to Axonius with a user account or Service Account whose role has the API access enabled permission.
  2. At the bottom of the Navigation toolbar, click on your account avatar.

APIUserSettings.png

  1. Click User Settings and then click the API Key tab. Copy the existing API key and secret. To reset them, click Reset Key.
    APIKeySecret-2.png

The Headers to Use for the REST API in Postman

When sending an API request using the REST API with Postman, the API key and API secret and other information must be provided as Headers. In Postman, you enter these values in the Headers tab.

To enter the API Key and API Secret into Postman headers:

  1. On the Headers tab, click in the Key field of the last row and enter the text api-key. As soon as you enter a value in this row, a new empty row is added below the current row.
  2. In the Value field enter the API Key obtained using the instructions above.
  3. In the next row, in the Key field enter api-secret.
  4. In the Value field enter the API Secret obtained using the instructions above.

You also must define the content type.

To specify the content type:

  1. On the Headers tab, in the empty Key and Value fields under api-secret, enter the following:
    • In the Key field enter Content-Type.
    • In the Value field enter application/vnd.api+json.

REST-API-Headers.png

Enable API Access Permission

Using the Axonius API to query Axonius assets requires a that the user's role will have the API Access enabled permission enabled.

To set this permission:

  1. Open the Manage Roles page.
    From the top right corner of all pages, click image.png. The System Settings page opens. Then, click the Manage Roles tab.

    image.png

  2. Select the relevant role as described in Manage Roles. For the selected role, under the API Access category, select the API access enabled checkbox.
    image.png

  3. Click Save.


Was this article helpful?