Edit this page on GitHub

Home > docs > api > Inventory

Inventory

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": "..." },
        ...
      ]