|
| 1 | +# ITFlow API - PowerShell examples |
| 2 | +# https://itflow.org |
| 3 | + |
| 4 | +# Update asset(s) |
| 5 | + |
| 6 | +# API Key |
| 7 | +$apiKey = "a1wEoh1F3omPhea6" |
| 8 | + |
| 9 | +# Base site URL |
| 10 | +$siteUrl = "https://demo.itflow.org" |
| 11 | + |
| 12 | +# Data |
| 13 | +# Unspecified values will not be modified |
| 14 | +# Client ID is required if the API key used has scope/access to all clients |
| 15 | +# (ensure to remove trailing comma from network id if removing). |
| 16 | +$body = @" |
| 17 | +{ |
| 18 | + "api_key" : "$apiKey", |
| 19 | + "asset_id" : "34", |
| 20 | + "asset_name" : "My Laptop 2", |
| 21 | + "asset_type" : "Laptop", |
| 22 | + "asset_make" : "Dell", |
| 23 | + "asset_model" : "Optiplex", |
| 24 | + "asset_serial" : "XYZ", |
| 25 | + "asset_os" : "Windows 10", |
| 26 | + "asset_ip" : "192.168.10.10", |
| 27 | + "asset_mac" : "", |
| 28 | + "asset_purchase_date" : "", |
| 29 | + "asset_warranty_expire" : "2024-02-01", |
| 30 | + "asset_install_date" : "", |
| 31 | + "asset_notes" : "This is a cool laptop!", |
| 32 | + "asset_meshcentral_id" : "", |
| 33 | + "asset_vendor_id" : "", |
| 34 | + "asset_location_id" : "", |
| 35 | + "asset_contact_id" : "", |
| 36 | + "asset_network_id" : "0", |
| 37 | + "client_id" : "1" |
| 38 | +} |
| 39 | +"@ |
| 40 | + |
| 41 | +# Module / Endpoint |
| 42 | +$module = "/api/v1/assets/update.php" |
| 43 | + |
| 44 | +# Build URI from defined data |
| 45 | +$uri = $siteUrl + $module |
| 46 | + |
| 47 | +# Request |
| 48 | +# Use Invoke-WebRequest instead to see more info about the request/response |
| 49 | +Invoke-RestMethod -Method Post -Uri $uri -Body $body |
| 50 | + |
0 commit comments