Table of Contents

Assets

Manage your client's laptops, servers and networking gear with the assets module.

The following information can be recorded for each asset:

Assets can also be associated with other data in ITFlow, such as:

Import & Export CSV


API

/api/v1/assets

Read

Retrieve asset information - /read.php.

Invoke-RestMethod -Uri "https://demo.itflow.org/api/v1/assets/read.php?api_key=YOUR-API-KEY&asset_id=7" | ConvertTo-Json


{
  "success":  "True",
  "count":  1,
  "data":  [
         {
           "0":  "7",
           "asset_id":  "7",
           "1":  "Laptop",
           "asset_type":  "Laptop",
           "2":  "Sample Laptop",
           "asset_name":  "Sample Laptop",
[...]

Create

Create a new asset - /create.php.

Specify parameters as below. The new asset ID will be returned.

$uri = "https://demo.itflow.org/api/v1/assets/create.php"

$body = @"
{
  "api_key" : "YOUR-API-KEY",
  "asset_name" : "Sample Laptop",
  "asset_type" : "Laptop",
  "asset_make" : "Dell",
  "asset_model" : "Optiplex",
  "asset_serial" : "XYZ",
  "asset_os" : "Win 10",
  "asset_ip" : "",
  "asset_mac" : "",
  "asset_status" : "Deployed",
  "asset_purchase_date" : "0000-00-00",
  "asset_warranty_expire" : "0000-00-00",
  "install_date" : "0000-00-00",
  "asset_notes" : "",
  "asset_vendor_id" : "",
  "asset_location_id" : "",
  "asset_contact_id" : "",
  "asset_network_id" : "",
  "client_id" : "1"
}
"@


Invoke-RestMethod -Method Post -Uri $uri -Body $body

success count data       
------- ----- ----       
True  1   {@{insert_id=41}}

Update

Update attributes of an existing asset - /update.php.

Only parameters specified are changed, remove parameters you don't want to modify. True/False is returned.

$uri = "https://demo.itflow.org/api/v1/assets/update.php"

$body = @"
{
  "api_key" : "YOUR-API-KEY",
  "asset_name" : "Sample Changed Laptop",
  "asset_type" : "Laptop",
  "asset_make" : "Dell",
  "asset_model" : "Optiplex",
  "asset_serial" : "XYZ",
  "asset_os" : "Win 10",
  "asset_ip" : "",
  "asset_mac" : "",
  "asset_status" : "Deployed",
  "asset_purchase_date" : "",
  "asset_warranty_expire" : "",
  "install_date" : "",
  "asset_notes" : "",
  "asset_vendor_id" : "",
  "asset_location_id" : "",
  "asset_contact_id" : "",
  "asset_network_id" : "",
  "client_id" : "1"
}
"@


Invoke-RestMethod -Method Post -Uri $uri -Body $body

success count
------- -----
True    1

Delete

Delete an asset - /delete.php.

$uri = "https://demo.itflow.org/api/v1/assets/delete.php"

$body = @"
{
  "api_key" : "YOUR-API-KEY",
  "asset_id" : "10",
  "client_id" : "1"
}
"@


Invoke-RestMethod -Method Post -Uri $uri -Body $body

success count
------- -----
True    1