0

I'm trying to post several bank transactions to Xero using the BankTransactions endpoint, I've been using the api-explorer to test my json code but can't seem to get this to work.

I don't know whether this is possible, or if my json isn't written correctly, could someone help me please? Thank you!

{"Type": "SPEND",
"Contact": {"ContactID": "699f0091-b127-4796-9f15-41a2f42abeb2"},
"LineAmountTypes": "Inclusive",
"LineItems": [{
"Description": "Monthly Retainer",
"UnitAmount": "29.80",
"TaxType":"NONE",
"AccountCode": "300"}],
"BankAccount": {"Code": "090"},

"Type": "SPEND",
"Contact": {"ContactID": "699f0091-b127-4796-9f15-41a2f42abeb2"},
"LineAmountTypes": "Inclusive",
"LineItems": [{
"Description": "Monthly Retainer",
"UnitAmount": "100.00",
"TaxType":"NONE",
"AccountCode": "300"}],
"BankAccount": {"Code": "090"}
}

The above creates onr transaction with two line items (totalling 129.80)

Ken White
  • 123,280
  • 14
  • 225
  • 444
J S
  • 1

1 Answers1

0

Your JSON is not valid. It needs to be like below:

{
  "BankTransactions": [
    {
      "Type": "SPEND",
      "Contact": {
        "Contact": {
          "ContactID": "699f0091-b127-4796-9f15-41a2f42abeb2"
        }
      },
      "LineAmountTypes": "Inclusive",
      "LineItems": [
        {
          "Description": "Monthly Retainer",
          "UnitAmount": "29.80",
          "TaxType": "NONE",
          "AccountCode": "300"
        }
      ],
      "BankAccount": {
        "Code": "090"
      }
    },
    {
      "Type": "SPEND",
      "Contact": {
        "Contact": {
          "ContactID": "699f0091-b127-4796-9f15-41a2f42abeb2"
        }
      },
      "LineAmountTypes": "Inclusive",
      "LineItems": [
        {
          "Description": "Monthly Retainer",
          "UnitAmount": "100.00",
          "TaxType": "NONE",
          "AccountCode": "300"
        }
      ],
      "BankAccount": {
        "Code": "090"
      }
    }
  ]
}