Edit this page on GitHub

Home > docs > api > inventory > Inventory

Inventory

Note: the Inventory API is deprecated in favor of the JSON Store API.

An organization can contain one or more inventories.

The REST API provides support for working with inventories:

To remove a project’s value, specify an empty value. For example, you can use an empty parent inventory JSON object to remove a parent inventory from an inventory.

Create an Inventory

Creates a new inventory with specified parameters.

  • URI /api/v1/org/{orgName}/inventory
  • Method POST
  • Headers Authorization, Content-Type: application/json
  • Body
      {
        "name": "inventory",
        "orgId": "---",
        "orgName": "---",
        "visibility": "Public/Private",
        "owner": {
          "id": "---",
          "username": "---"
             },
        "parent": {
          "id": "---",
          "name": "---",
          ...
             }
      }
    

    All parameters except name are optional.

    Parent inventory is also an inventory JSON object.

  • Success response

      Content-Type: application/json
    
      {
        "result": "CREATED",
        "ok": true,
        "id": "..."
      }
    

Update an Inventory

Updates parameters of an existing inventory.

  • URI /api/v1/org/{orgName}/inventory
  • Method POST
  • Headers Authorization, Content-Type: application/json
  • Body
      {
        "name": "new name",
        "id": "---",
        "orgId": "---",
        "orgName": "---",
        "visibility": "---",
        "owner": {
          "id": "---",
          "username": "---"
             },
        "parent": {
          "id": "---",
          "name": "---",
          ...
             }
      }
    

    All parameters are optional except when updating inventory ‘name’, ‘id’ is required.

    Omitted parameters are not updated.

  • Success response

      Content-Type: application/json
    
      {
        "result": "UPDATED",
        "ok": true,
        "id": "..."
      }
    

Delete an Inventory

Removes an existing inventory and all its data and associated queries.

  • URI /api/v1/org/${orgName}/inventory/${inventoryName}
  • Method DELETE
  • Headers Authorization
  • Body none
  • Success response
      Content-Type: application/json
    
      {
        "ok": true,
        "result": "DELETED"
      }
    

List Inventories

Lists all existing inventories for the specified organization.

  • URI /api/v1/org/${orgName}/inventory
  • Method GET
  • Body none
  • Success response
      Content-Type: application/json
    
      [
        { "id": "...", "name": "..." },
        ...
      ]
    

Add Host Data to an Inventory

Adds or updates host data. ${itemPath} is a unique to identify the data (e.g. a fully-qualified hostname).

  • URI /api/v1/org/${orgName}/inventory/${inventoryName}/data/${itemPath}
  • Method POST
  • Headers Authorization, Content-Type: application/json
  • Body
      {
        "host": "my.host.example.com",
        "meta": {
          "env": "cert",
          ...
        }
      }
    
  • Success Response
      Content-Type: application/json
    
      {
        "host": "my.host.example.com",
        "meta": {
          "env": "cert",
          ...
        }
      }