I am inserting new entries through the Rest API of Exact Online. However, I can not seem to find a way to state which amount is debit or credit. I thought that depending on what GLAccount you use for the entry, that amount would automatically change to debit or credit. As you can see in the code example below, the entry line with description "APITESTDEBIT2" has the GLAccount with debit type. The other line is credit type.
I get this 500 server error when I POST:
This entry is not balanced on: 2021 / 12 (Type: Other) - Difference: EUR 1.000,00
{
"EntryID" : "xxx", ---> Generated GUID
"JournalCode" : "900",
"GeneralJournalEntryLines": [
{
"Date" : "2021-12-27",
"Description" : "APITESTDEBIT2",
"EntryID" : "xxx", --> reference to generated GUID
"GLAccount" : "xxx", --> GLAccount GUID (debit)
"AmountFC" : 500
},
{
"Date" : "2021-12-27",
"Description" : "APITESTCREDIT2",
"EntryID" : "xxx", --> reference to generated GUID
"GLAccount" : "xxx", --> GLAccount GUID (credit)
"AmountFC" : 500
}
]
}
Thanks to @fredrik, you can identify credit or debit by making it positive or negative.
Positive amount = debit
Negative amount = credit
{
"EntryID" : "xxx", ---> Generated GUID
"JournalCode" : "900",
"GeneralJournalEntryLines": [
{
"Date" : "2021-12-27",
"Description" : "APITESTDEBIT2",
"EntryID" : "xxx", --> reference to generated GUID
"GLAccount" : "xxx", --> GLAccount GUID (debit)
"AmountFC" : 500 --> this is debit
},
{
"Date" : "2021-12-27",
"Description" : "APITESTCREDIT2",
"EntryID" : "xxx", --> reference to generated GUID
"GLAccount" : "xxx", --> GLAccount GUID (credit)
"AmountFC" : -500 --> this is credit
}
]
}