For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Open sourceSupportFAQsDocs Home
DocumentationRelease notes
DocumentationRelease notes
  • Itential Automation Gateway
    • Overview
    • Related terminology
    • Navigate UI
      • Inventory integration variables
      • Create and manage devices
      • Remove a device
      • Manage inventory via API
      • Inventory sources
      • Interactive devices
      • Inventory encryption
      • Device broker support
      • Interactive devices 2023.2
    • Automatic discovery in IAG
    • Use hidden keyword extension
    • Edit the description field
    • Edit JSON schema
    • Manage decorations
    • View audit logs
LogoLogo
Open sourceSupportFAQsDocs Home
On this page
  • Getting started with the API
  • Add a device
  • Get a device list
  • Get configuration for a device
  • Run a command on a device
Itential Automation GatewayInventory devices

Manage inventory via API

Was this page helpful?
Previous

Inventory sources

Next
Built with

Getting started with the API

For a complete API reference, use the API Documentation link in the Itential Automation Gateway UI. The interface allows you to browse and interact with the Itential Automation Gateway API.

Add a device

If an existing Ansible Inventory is not already configured, you can add a new device to IAG using the API. The following is an example curl script to add a device.

$curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ "password": "admin", "username": "admin@itential" }' 'http://localhost:8083/api/v2.0/login'
${"token": "NTAuMjczOTA4MTYwNDM5OTY2"}
$curl -X POST --header 'Authorization: <COPY TOKEN VALUE FROM PREVIOUS CMD HERE>' --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{
> "name": "ios02",
> "variables": {
> "ansible_host": "192.168.32.79",
> "ansible_port": 22,
> "ansible_user": "ios-user",
> "ansible_ssh_private_key_file": "/path/to/key",
> "ansible_network_os": "ios",
> "ansible_connection": "network_cli"
> }
> }' 'https://localhost:8083/api/v2.0/devices'

Get a device list

Use the following command to get a list of managed devices.

$curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ "password": "admin", "username": "admin@itential" }' 'http://localhost:8083/api/v2.0/login'
${"token": "NTAuMjczOTA4MTYwNDM5OTY2"}
$curl -X GET --header 'Authorization: <COPY TOKEN VALUE FROM PREVIOUS CMD HERE>' --header 'Accept: application/json' 'http://localhost:8083/api/v2.0/devices'

Get configuration for a device

Use the following command to retrieve the configuration for a managed device.

$curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ "password": "admin", "username": "admin@itential" }' 'http://localhost:8083/api/v2.0/login'
${"token": "NTAuMjczOTA4MTYwNDM5OTY2"}
$curl -X POST --header 'Authorization: <COPY TOKEN VALUE FROM PREVIOUS CMD HERE>' --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{
> "hosts": [ "ios01" ]
> }' 'https://localhost:8083/api/v2.0/roles/itential_get_config/execute'

For Itential Automation Gateway 2022.1, use the following endpoint instead:

$curl -X POST --header 'Authorization: <COPY TOKEN VALUE FROM PREVIOUS CMD HERE>' --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{
> "hosts": [ "ios01" ],
> "template": "ios_config"
> }' 'https://localhost:8083/api/v2.0/getConfig'

Run a command on a device

Use the following to run a command on a managed device.

$curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ "password": "admin", "username": "admin@itential" }' 'http://localhost:8083/api/v2.0/login'
${"token": "NTAuMjczOTA4MTYwNDM5OTY2"}
$curl -X POST --header 'Authorization: <COPY TOKEN VALUE FROM PREVIOUS CMD HERE>' --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{
> "command": [ "show version" ],
> "hosts": [ "ios01" ]
> }' 'https://localhost:8083/api/v2.0/roles/itential_cli/execute'

For Itential Automation Gateway 2022.1, use the following endpoint instead:

$curl -X POST --header 'Authorization: <COPY TOKEN VALUE FROM PREVIOUS CMD HERE>' --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{
> "command": [ "show version" ],
> "hosts": [ "ios01" ],
> "template": "ios_command"
> }' 'https://localhost:8083/api/v2.0/runCommand'