Assets
Manage assets in your Smart Inventory.
List assets
Returns all assets for your company.
Response
Create an asset
Creates a new asset.
const res = await fetch(
"https://nightly.api.trustview.eu/external/smart-inventory/asset/new",
{
method: "POST",
headers: {
"X-API-Key": "tvw_sk_live_your_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Customer Database",
description: "<p>Main customer data store</p>",
active: true,
}),
}
);
const asset = await res.json();
$ch = curl_init('https://nightly.api.trustview.eu/external/smart-inventory/asset/new');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-API-Key: tvw_sk_live_your_key_here',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'name' => 'Customer Database',
'description' => '<p>Main customer data store</p>',
'active' => true,
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = json_decode(curl_exec($ch));
curl_close($ch);
Response
Returns the created asset object.
Get an asset
Retrieves a single asset by its unique ID.
| Name | In | Type | Description |
|---|---|---|---|
asset |
path | string | Enter asset's unique ID |
Tip
The asset's unique ID can be found in the address bar when viewing an asset.
Update an asset
Updates an existing asset. Send only the fields you want to change.
| Name | In | Type | Description |
|---|---|---|---|
asset |
path | string | Enter asset's unique ID |
Tip
The asset's unique ID can be found in the address bar when viewing an asset.
$ch = curl_init('https://nightly.api.trustview.eu/external/smart-inventory/asset/6a054b8b9ae1a/edit');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-API-Key: tvw_sk_live_your_key_here',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['name' => 'Customer Database (EU region)']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
Response
Returns 204 No Content on success.
Delete an asset
Removes an asset.
| Name | In | Type | Description |
|---|---|---|---|
asset |
path | string | Enter asset's unique ID |
Tip
The asset's unique ID can be found in the address bar when viewing an asset.
$ch = curl_init('https://nightly.api.trustview.eu/external/smart-inventory/asset/6a054b8b9ae1a/delete');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['X-API-Key: tvw_sk_live_your_key_here']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
Response
Returns 204 No Content on success.