Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Wrapper libraries >

TrackOptionID missing JSON Item Tracking

Started by Peter Henry -   in Wrapper libraries


I am trying to get the TrackingOptionID associated with a line item in an invoice using https://api.xero.com/api.xro/2.0/invoices

However, there is no TrackingOptionID returned with the LineItems, only the Name of the Tracking Option.

My JSON response looks like this (only the LineItems part of the response is shown)

"ItemCode": "EQPMNT20",
"Description": "Shade Cloth Metres",
"UnitAmount": 5.0000,
"TaxType": "TAX001",
"TaxAmount": 15.00,
"LineAmount": 100.00,
"AccountCode": "200",
"Name": "Department",
"Option": "Hire It Out",
"TrackingCategoryID": "be6a10e7-3ba0-4ae6-86bb-21cef4e45a01",
"Quantity": 20.0000,
"LineItemID": "8418f34a-1a8a-4498-ba5d-9d1398bc13fb"

Yet, the response on the API Previewer includes the TrackingOptionID. I don't understand why they differ.

<Description>Shade Cloth Metres</Description>
<Option>Hire It Out</Option>
The same occurs when I try to get the TrackingOptionID associated with a line item in a Bank Transaction using the Bank Transactions Endpoint.

I get the tracking category id and the category and option names. The TrackingOptionID is an empty (all 0s) Guid

However, the response on the API Previewer includes the TrackingOptionID
<Description>Refund on wrong toner</Description>


Rajarshi Das  

Hi Rajarshi,

That was the same response I got. An empty TrackingOptionID Guid with all 0's.

Peter Henry  

I am getting the same on Get All Invoices (with paging), I am actually getting a blank node

Tracking: []

When I get the same invoice using GUID (single), then I get the Tracking info

Chris Go  

I am facing the same problem two years later. Did anybody ever find a solution?

Klaus Jensen  

I don't do a lot so I think (not 100% sure, been a while) I just go through it slowly -- loop through the list and get each invoice one at a time.

Chris Go  

Thanks Chris. That is also what I ended up going.

Klaus Jensen  

I was also hoping for the TrackingOptionId. I might just cache a copy of all the tracking options and then look up the id by name from that list, but that's a bit hacky as it assumes names aren't changed very often.

Daniel Manson