Xero Assets API

Asset

createAsset

adds a fixed asset

Adds an asset to the system


/Assets

Usage and SDK Samples

xero_client.set_token_set(user.token_set)

xero_tenant_id = 'YOUR_XERO_TENANT_ID'
idempotency_key = 'KEY_VALUE'

asset = { 
  asset_name: "Other Computer",
  asset_number: "FA-00210",
  status:  XeroRuby::Asset::AssetStatus::DRAFT
}  

begin
  response = xero_client.accounting_api.create_asset(xero_tenant_id, asset, idempotency_key)
  return response
rescue XeroRuby::ApiError => e
  puts "Exception when calling create_asset: #{e}"
end

Scopes

assets Grant read-write access to fixed assets

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
asset *
Asset
Fixed asset you are creating
Required

createAssetType

adds a fixed asset type

Adds an fixed asset type to the system


/AssetTypes

Usage and SDK Samples

xero_client.set_token_set(user.token_set)

xero_tenant_id = 'YOUR_XERO_TENANT_ID'
idempotency_key = 'KEY_VALUE'

book_depreciation_setting = { 
  depreciation_method: "DiminishingValue100",
  averaging_method: "ActualDays",
  deprecitation_rate: 40,
  depreciation_calculation_method: "None"
}  

asset_type = { 
  asset_type_name: "Computer Equipment",
  fixed_asset_account_id: "00000000-0000-0000-0000-000000000000",
  depreciation_expense_account_id: "00000000-0000-0000-0000-000000000000",
  accumulated_depreciation_account_id: "00000000-0000-0000-0000-000000000000",
  book_depreciation_setting:  book_depreciation_setting
}  

begin
  response = xero_client.accounting_api.create_asset_type(xero_tenant_id, assetType, idempotency_key)
  return response
rescue XeroRuby::ApiError => e
  puts "Exception when calling create_asset_type: #{e}"
end

Scopes

assets Grant read-write access to fixed assets

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
assetType *
AssetType
Asset type to add
Required

getAssetById

Retrieves fixed asset by id

By passing in the appropriate asset id, you can search for a specific fixed asset in the system


/Assets/{id}

Usage and SDK Samples

xero_client.set_token_set(user.token_set)

xero_tenant_id = 'YOUR_XERO_TENANT_ID'
id = '00000000-0000-0000-0000-000000000000'

begin
  response = xero_client.accounting_api.get_asset_by_id(xero_tenant_id, id)
  return response
rescue XeroRuby::ApiError => e
  puts "Exception when calling get_asset_by_id: #{e}"
end

Scopes

assets Grant read-write access to fixed assets
assets.read Grant read-only access to fixed assets

Parameters

Path parameters
Name Description
id*
UUID (uuid)
fixed asset id for single object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getAssetSettings

searches fixed asset settings

By passing in the appropriate options, you can search for available fixed asset types in the system


/Settings

Usage and SDK Samples

xero_client.set_token_set(user.token_set)

xero_tenant_id = 'YOUR_XERO_TENANT_ID'

begin
  response = xero_client.accounting_api.get_asset_settings(xero_tenant_id)
  return response
rescue XeroRuby::ApiError => e
  puts "Exception when calling get_asset_settings: #{e}"
end

Scopes

assets Grant read-write access to fixed assets
assets.read Grant read-only access to fixed assets

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getAssetTypes

searches fixed asset types

By passing in the appropriate options, you can search for available fixed asset types in the system


/AssetTypes

Usage and SDK Samples

xero_client.set_token_set(user.token_set)

xero_tenant_id = 'YOUR_XERO_TENANT_ID'

begin
  response = xero_client.accounting_api.get_asset_types(xero_tenant_id)
  return response
rescue XeroRuby::ApiError => e
  puts "Exception when calling get_asset_types: #{e}"
end

Scopes

assets Grant read-write access to fixed assets
assets.read Grant read-only access to fixed assets

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getAssets

searches fixed asset

By passing in the appropriate options, you can search for available fixed asset in the system


/Assets

Usage and SDK Samples

xero_client.set_token_set(user.token_set)

xero_tenant_id = 'YOUR_XERO_TENANT_ID'
status = 
page = 1
page_size = 5
order_by = 'AssetName'
sort_direction = 'ASC'
filter_by = 'Company Car'

begin
  response = xero_client.accounting_api.get_assets(xero_tenant_id, status, page, page_size, order_by, sort_direction, filter_by)
  return response
rescue XeroRuby::ApiError => e
  puts "Exception when calling get_assets: #{e}"
end

Scopes

assets Grant read-write access to fixed assets
assets.read Grant read-only access to fixed assets

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
status*
AssetStatusQueryParam
Required when retrieving a collection of assets. See Asset Status Codes
Required
page
Integer
Results are paged. This specifies which page of the results to return. The default page is 1.
pageSize
Integer
The number of records returned per page. By default the number of records returned is 10.
orderBy
String
Requests can be ordered by AssetType, AssetName, AssetNumber, PurchaseDate and PurchasePrice. If the asset status is DISPOSED it also allows DisposalDate and DisposalPrice.
sortDirection
String
ASC or DESC
filterBy
String
A string that can be used to filter the list to only return assets containing the text. Checks it against the AssetName, AssetNumber, Description and AssetTypeName fields.