createAsset
adds a fixed asset
Adds an asset to the system
/Assets
Usage and SDK Samples
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );
$apiInstance = new XeroAPI\XeroPHP\Api\AssetApi(
new GuzzleHttp\Client(),
$config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$asset = new XeroAPI\XeroPHP\Models\Asset\Asset;
$asset->setassetName('Other Computer');
$asset->setassetNumber('FA-00210');
$asset->setStatus(XeroAPI\XeroPHP\Models\Asset\AssetStatus::Draft);
try {
$result = $apiInstance->createAsset($xeroTenantId, $asset);
} catch (Exception $e) {
echo 'Exception when calling AssetApi->createAsset: ', $e->getMessage(), PHP_EOL;
}
?>
Scopes
assets | Grant read-write access to fixed assets |
Parameters
Name | Description |
---|---|
xero-tenant-id* |
String
Xero identifier for Tenant
Required
|
Name | Description |
---|---|
asset * |
Asset
Fixed asset you are creating
Required
|