Documentation

12. Inventory List API Endpoint

Make a GET request to this resource to retrieve the list of inventories.

GET /api/v1/inventories/
HTTP 200 OK
Content-Type: application/json
Vary: Accept
Allow: GET, POST, HEAD, OPTIONS
X-API-Time: 0.046s

The resulting data structure contains:

{
    "count": 0,
    "next": null,
    "previous": null,
    "results": []
}

The count field indicates the total number of inventory lists found for the given query. The next and previous fields provides links to additional results if there are more than will fit on a single page. The results list contains zero or more inventory records.

12.1. Results

Each inventory data structure includes the following fields:

  • id: Database ID for this inventory. (integer)
  • type: Data type for this inventory. (multiple choice)
    • inventory: Inventory
  • url: URL for this inventory. (string)
  • related: Data structure with URLs of related resources. (object)
  • summary_fields: Data structure with name/description for related resources. (object)
  • created: Timestamp when this inventory was created. (datetime)
  • modified: Timestamp when this inventory was last modified. (datetime)
  • name: (string)
  • description: (string)
  • organization: (field)
  • variables: Inventory variables in JSON or YAML format. (string)
  • has_active_failures: Flag indicating whether any hosts in this inventory have failed. (boolean)
  • total_hosts: Total number of hosts in this inventory. (integer)
  • hosts_with_active_failures: Number of hosts in this inventory with active failures. (integer)
  • total_groups: Total number of groups in this inventory. (integer)
  • groups_with_active_failures: Number of groups in this inventory with active failures. (integer)
  • has_inventory_sources: Flag indicating whether this inventory has any external inventory sources. (boolean)
  • total_inventory_sources: Total number of external inventory sources configured within this inventory. (integer)
  • inventory_sources_with_failures: Number of external inventory sources in this inventory with failures. (integer)

12.2. Create Inventories

Make a POST request to this resource with the following inventory fields to create a new inventory:

  • name: (string, required)
  • description: (string, default=””)
  • organization: (field, required)
  • variables: Inventory variables in JSON or YAML format. (string, default=””)

12.3. Reviewing the Options Endpoint

The Options Endpoint table offers a view of the Options for this endpoint. When viewing the endpoint in the browsable API, clicking the “Options” button gives you the raw JSON for the following:

name Inventory List
description # List Inventories: Make a GET request to this resource to retrieve the list of inventories.
renders
0 application/json
1 text/html
parses
0 application/json
added_in_version 1.2
actions
POST
name
type string
required
true
label name
max_length 512
description
type string
required
false
label description
default (Empty Text)
organization
type field
required
true
variables
type string
required
false
label variables
help_text Inventory variables in JSON or YAML format.
default (Empty Text)
GET
id
type integer
label ID
help_text Database ID for this inventory.
type
type multiple choice
help_text Data type for this inventory.
choices
0
0 inventory
1 Inventory
url
type string
help_text URL for this inventory.
related
type object
help_text Data structure with URLs of related resources.
summary_fields
type object
help_text Data structure with name/description for related resources.
created
type datetime
help_text Timestamp when this inventory was created.
modified
type datetime
help_text Timestamp when this inventory was last modified.
name
type string
label name
description
type string
label description
organization
type field
variables
type string
label variables
help_text Inventory variables in JSON or YAML format.
has_active_failures
type boolean
label has active failures
help_text Flag indicating whether any hosts in this inventory have failed.
total_hosts
type integer
label total hosts
help_text Total mumber of hosts in this inventory.
hosts_with_active_failures
type integer
label hosts with active failures
help_text Number of hosts in this inventory with active failures.
total_groups
type integer
label total groups
help_text Total number of groups in this inventory.
groups_with_active_failures
type integer
label groups with active failures
help_text Number of groups in this inventory with active failures.
has_inventory_sources
type boolean
label has inventory sources
help_text Flag indicating whether this inventory has any external inventory sources.
total_inventory_sources
type integer
label total inventory sources
help_text Total number of external inventory sources configured within this inventory.
inventory_sources_with_failures
type integer
label inventory sources with failures
help_text Number of external inventory sources in this inventory with failures.
types
0 inventory
search_fields
0 description
1 name