Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Endpoints >

ManualJournals and JSON Validation Error

Started by Ryan Lott -   in API Endpoints

I am receiving validation errors when posting agains the ManalJournals endpoint using JSON. It works fine if I switch to XML.

Here is the error:

<ApiException xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ErrorNumber>10</ErrorNumber>
<Type>ValidationException</Type>
<Message>A validation exception occurred</Message>
<Elements>
<DataContractBase xsi:type="ManualJournal">
<ValidationErrors>
<ValidationError>
<Message>A Manual Journal must contain at least 2 lines</Message>
</ValidationError>
<ValidationError>
<Message>The Narration field is mandatory</Message>
</ValidationError>
</ValidationErrors>
<Date>2019-09-16T00:00:00</Date>
<Status>DRAFT</Status>
<LineAmountTypes>NoTax</LineAmountTypes>
<ManualJournalID>00000000-0000-0000-0000-000000000000</ManualJournalID>
</DataContractBase>
</Elements>
</ApiException>


Also I would like to receive a response in JSON rather than XML once this is actually working



Hi Ryan,

I'm not sure if I can tell you anything based just on the errors except ask you to check that you're including the things it's asking about correctly. If you can share the JSON request you're sending through then we might be able to spot something.

As far as the error coming back in JSON, you should receive the errors in JSON if you set the 'accept' header on your request to 'application/json'

Cheers,

Steven.
 

Steven Brown (Xero Staff)