Retrieve an Inventory

get

/api/v2/inventories/{id}/

Make GET request to this resource to retrieve a single inventory record containing the following fields:

  • id: Database ID for this inventory. (integer)
  • type: Data type for this inventory. (choice)
  • 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. The output for some objects may be limited for performance reasons. (object)
  • created: Timestamp when this inventory was created. (datetime)
  • modified: Timestamp when this inventory was last modified. (datetime)
  • name: Name of this inventory. (string)
  • description: Optional description of this inventory. (string)
  • organization: Organization containing this inventory. (id)
  • kind: Kind of inventory being represented. (choice)
    • "": Hosts have a direct link to this inventory.
    • smart: Hosts for inventory generated using the host_filter property.
  • host_filter: Filter that will be applied to the hosts of this inventory. (string)
  • variables: Inventory variables in JSON or YAML format. (json)
  • has_active_failures: This field is deprecated and will be removed in a future release. Flag indicating whether any hosts in this inventory have failed. (boolean)
  • total_hosts: This field is deprecated and will be removed in a future release. Total number of hosts in this inventory. (integer)
  • hosts_with_active_failures: This field is deprecated and will be removed in a future release. Number of hosts in this inventory with active failures. (integer)
  • total_groups: This field is deprecated and will be removed in a future release. Total number of groups in this inventory. (integer)
  • has_inventory_sources: This field is deprecated and will be removed in a future release. 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)
  • pending_deletion: Flag indicating the inventory is being deleted. (boolean)

Request

Supported Media Types
Path Parameters
Query Parameters
Back to Top

Response

Supported Media Types

200 Response

Body
Example Response (application/json)
{
    "created":"2018-02-01T08:00:00.000000Z",
    "description":"",
    "has_active_failures":false,
    "has_inventory_sources":true,
    "host_filter":null,
    "hosts_with_active_failures":"0",
    "id":"1",
    "inventory_sources_with_failures":"0",
    "kind":"",
    "modified":"2018-02-01T08:00:00.000000Z",
    "name":"test-inv",
    "organization":"1",
    "pending_deletion":false,
    "related":{
        "access_list":"/api/v2/inventories/1/access_list/",
        "activity_stream":"/api/v2/inventories/1/activity_stream/",
        "ad_hoc_commands":"/api/v2/inventories/1/ad_hoc_commands/",
        "copy":"/api/v2/inventories/1/copy/",
        "groups":"/api/v2/inventories/1/groups/",
        "hosts":"/api/v2/inventories/1/hosts/",
        "instance_groups":"/api/v2/inventories/1/instance_groups/",
        "inventory_sources":"/api/v2/inventories/1/inventory_sources/",
        "job_templates":"/api/v2/inventories/1/job_templates/",
        "object_roles":"/api/v2/inventories/1/object_roles/",
        "organization":"/api/v2/organizations/1/",
        "root_groups":"/api/v2/inventories/1/root_groups/",
        "script":"/api/v2/inventories/1/script/",
        "tree":"/api/v2/inventories/1/tree/",
        "update_inventory_sources":"/api/v2/inventories/1/update_inventory_sources/",
        "variable_data":"/api/v2/inventories/1/variable_data/"
    },
    "summary_fields":{
        "object_roles":{
            "adhoc_role":{
                "description":"May run ad hoc commands on the inventory",
                "id":"18",
                "name":"Ad Hoc"
            },
            "admin_role":{
                "description":"Can manage all aspects of the inventory",
                "id":"16",
                "name":"Admin"
            },
            "read_role":{
                "description":"May view settings for the inventory",
                "id":"20",
                "name":"Read"
            },
            "update_role":{
                "description":"May update the inventory",
                "id":"17",
                "name":"Update"
            },
            "use_role":{
                "description":"Can use the inventory in a job template",
                "id":"19",
                "name":"Use"
            }
        },
        "organization":{
            "description":"test-org-desc",
            "id":"1",
            "name":"test-org"
        },
        "user_capabilities":{
            "adhoc":true,
            "copy":true,
            "delete":true,
            "edit":true
        }
    },
    "total_groups":"0",
    "total_hosts":"0",
    "total_inventory_sources":"1",
    "type":"inventory",
    "url":"/api/v2/inventories/1/",
    "variables":""
}
Back to Top