Can Xero assets be modified using the Xero-Python API?

88 Views Asked by At

Hello Stack Overflow community,

I'm currently engaged in a project that involves updating Xero assets through the python-xero API. Despite my testing efforts, I have been unable to achieve this successfully. It appears that updating a draft asset should be possible based on my understanding.

def xero_create_asset(viper_asset): asset_api = AssetApi(api_client) xero_tenant_id = get_xero_tenant_id()

serial_number = 'serial_number'
xero_id = 'xero_id'
asset_name = 'Test'


asset = Asset(asset_id=xero_id,
              asset_name=asset_name, 
              asset_number = viper_asset['asset_id'],
              serial_number = serial_number)

# api_response = asset_api.create_asset(xero_tenant_id, asset)
api_akt = asset_api.create_asset
print(api_response)
return api_response

Xero API history

1

There are 1 best solutions below

1
sallyhornet On BEST ANSWER

You need to include the status field otherwise you will get the 403 forbidden error. You also need to include the asset number to avoid an error 400.