UPDATE - Journal_Create broken, too (IMHO)
Hi @QFMathew, while programmatically sending Journal_Create messages (the messages above were handcrafted using the API sandbox) I run into the following error message:
{
"Errors": {
"Error": [
"15The element 'JournalLine' in namespace 'http://www.QuickFile.co.uk' has invalid child element 'ItemDebitAccount' in namespace 'http://www.QuickFile.co.uk'. List of possible elements expected: 'http://www.QuickFile.co.uk:NominalCode'.",
"21The element 'JournalLine' in namespace 'http://www.QuickFile.co.uk' has invalid child element 'ItemCreditAccount' in namespace 'http://www.QuickFile.co.uk'. List of possible elements expected: 'http://www.QuickFile.co.uk:NominalCode'."
]
}
}
The messages have the following body structure:
"Body": {
"JournalDate": "****",
"JournalName": "****",
"JournalLine": [
{
"ItemDebitAccount": "****",
"NominalCode": ****,
"ItemDescription": "****",
"ItemNotes": "****"
},
{
"ItemCreditAccount": "****",
"NominalCode": ****,
"ItemDescription": "****",
"ItemNotes": "****"
}
]
}
Manually reordering the items and sending again fixes the problem. This is the same bug described here: JSON API ordering of values
The ordering of the journal line object is semantically irrelevant (certainly since the child elements are all named), and should not be enforced.
I am programming in Java, using subclasses of JournalLine for debit and credit instances, which causes the debit and credit figures to appear first. Another way of implementing this would cause proper ordering but at the cost of very bug-prone code along with too much error checking lint in my code.
Two other issues here: ItemCreditAccount and ItemDebitAccount are enforced to be Strings rather than decimal numbers - why? It doesn’t make any sense…
Thanks,
Michel