Vendors
Manage vendors in your Smart Inventory.
List vendors
Returns all vendors for your company.
Response
Create a vendor
Creates a new vendor.
const res = await fetch(
"https://nightly.api.trustview.eu/external/smart-inventory/vendor/new",
{
method: "POST",
headers: {
"X-API-Key": "tvw_sk_live_your_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Acme Cloud Services",
description: "<p>Primary cloud vendor</p>",
active: true,
}),
}
);
const vendor = await res.json();
$ch = curl_init('https://nightly.api.trustview.eu/external/smart-inventory/vendor/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' => 'Acme Cloud Services',
'description' => '<p>Primary cloud vendor</p>',
'active' => true,
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = json_decode(curl_exec($ch));
curl_close($ch);
Response
Returns the created vendor object.
Get a vendor
Retrieves a single vendor by its unique ID.
| Name | In | Type | Description |
|---|---|---|---|
vendor |
path | string | Enter vendor's unique ID |
Tip
The vendor's unique ID can be found in the address bar when viewing a vendor.
Update a vendor
Updates an existing vendor. Send only the fields you want to change.
| Name | In | Type | Description |
|---|---|---|---|
vendor |
path | string | Enter vendor's unique ID |
Tip
The vendor's unique ID can be found in the address bar when viewing a vendor.
$ch = curl_init('https://nightly.api.trustview.eu/external/smart-inventory/vendor/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' => 'Acme Cloud Services (updated)']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
Response
Returns 204 No Content on success.
Delete a vendor
Removes a vendor.
| Name | In | Type | Description |
|---|---|---|---|
vendor |
path | string | Enter vendor's unique ID |
Tip
The vendor's unique ID can be found in the address bar when viewing a vendor.
$ch = curl_init('https://nightly.api.trustview.eu/external/smart-inventory/vendor/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.