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

Hi,

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)

"LineItems":
{
"ItemCode": "EQPMNT20",
"Description": "Shade Cloth Metres",
"UnitAmount": 5.0000,
"TaxType": "TAX001",
"TaxAmount": 15.00,
"LineAmount": 100.00,
"AccountCode": "200",
"Tracking":
{
"Name": "Department",
"Option": "Hire It Out",
"TrackingCategoryID": "be6a10e7-3ba0-4ae6-86bb-21cef4e45a01",
"Options":
}
,
"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.

<LineItems>
<LineItem>
<ItemCode>EQPMNT20</ItemCode>
<Description>Shade Cloth Metres</Description>
<UnitAmount>5.00</UnitAmount>
<TaxType>TAX001</TaxType>
<TaxAmount>15.00</TaxAmount>
<LineAmount>100.00</LineAmount>
<AccountCode>200</AccountCode>
<Tracking>
<TrackingCategory>
<Name>Department</Name>
<Option>Hire It Out</Option>
<TrackingCategoryID>be6a10e7-3ba0-4ae6-86bb-21cef4e45a01</TrackingCategoryID>
<TrackingOptionID>44485ba0-2132-4b50-b744-6dd541251598</TrackingOptionID>
</TrackingCategory>
</Tracking>
<Quantity>20.0000</Quantity>
<LineItemID>8418f34a-1a8a-4498-ba5d-9d1398bc13fb</LineItemID>
</LineItem>
</LineItems>
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
<LineItems>
<LineItem>
<Description>Refund on wrong toner</Description>
<UnitAmount>39.50</UnitAmount>
<TaxType>INPUT</TaxType>
<TaxAmount>3.59</TaxAmount>
<LineAmount>39.50</LineAmount>
<AccountCode>461</AccountCode>
<Tracking>
<TrackingCategory>
<Name>Region</Name>
<Option>North</Option>
<TrackingCategoryID>093af706-c2aa-4d97-a4ce-2d205a017eac</TrackingCategoryID>
<TrackingOptionID>3f05cdf9-246b-46a2-bf6f-441da1b09b89</TrackingOptionID>
</TrackingCategory>
</Tracking>
<Quantity>1.0000</Quantity>
<LineItemID>7f4e9ff9-7920-48fe-897e-fa2529a41e77</LineItemID>
</LineItem>
</LineItems>

 

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