Daniel Williams
Daniel Williams

Reputation: 9304

Xero API - New Invoice Line is not Setting tracking category

I am writing a new invoice with one line item into Xero. It works fine, except that the Tracking Category is not being set.

I am following the instructions here: https://developer.xero.com/documentation/api/invoices#post

And below is part of the JSON being sent. All properties except tracking is being filled in. The tracking data comes from loaded TrackingCategories, so it is definitely correct.

"LineItems": [{
        "Description": "test",
        "LineAmount": 123.45,
        "Tracking": [{
            "TrackingCategoryID": "8990282b-63b6-459c-ab3b-cf7b8ff08bbc",
            "Name": "Project",
            "OptionName": "C17212 - 11 Boas Avenue, Joondalup"
        }],
        "Quantity": 1.0
    }]

Any ideas on what may be wrong with my PUT request? Everything except tracking is working.

Upvotes: 0

Views: 435

Answers (1)

Daniel Williams
Daniel Williams

Reputation: 9304

Got it. The documentation about the POST says to set "OptionName", but if you look at the examples on the side it shows "Option". And "Option" is the one that works.

Here is the written documentation:

enter image description here

And here is the example on the right side of the page:

enter image description here

Upvotes: 2

Related Questions