Announcements
I am trying to POST the journalLines for an existing Journal but keep getting the error that the body of the request is bad.
{"error":{"code":"BadRequest","message":"Invalid Request Body CorrelationId: 19a40eab-63ef-48f9-83ee-fbed9cc7557d."}}
The documentation is confusing in that it is showing the ID of the journalLine to be part of the POST. My experience using these API requests are that when you POST to Create an entry, the ID number is returned upon a successful POST. Here is the documentation:
POST https://{businesscentralPrefix}/api/v2.0/companies({id})/journals({id})/journalLines
Content-type: application/json
{
"id": "0a077d18-45e3-ea11-bb43-000d3a2feca1", This is the entry I don’t understand. How can you know the Journal Line GUID before it is created?
"journalId": "dd1b6a90-44e3-ea11-bb43-000d3a2feca1", I populated this field (journalId) with the Journal GUID that was returned from creating the header.
"journalDisplayName": "DEFAULT",
"lineNumber": 10000,
"accountType": "G/L Account",
"accountId": "00000000-0000-0000-0000-000000000000",
"accountNumber": "",
"postingDate": "2018-12-31",
"documentNumber": "",
"externalDocumentNumber": "",
"amount": 0,
"description": "",
"comment": "",
"lastModifiedDateTime": "0001-01-01T00:00:00Z"
}
Any assistance or an example would be greatly appreciated.
Hello,
Feel free to raise the issue to Microsoft via your partner or CSP if you cannot get passed the error. Via Get you can get the ID of the journal.
Thank you.
I did pass all of the fields you mention but still am getting the error.
Hi,
You have pass below fields from Gen Line.
Like : Template name, Batch Name, Line No., Account No. Posting Date, Amount, Bal. Acc. Type and Name. etc. Not the ID or other system created field.
I get the same error without an id
Hi,
In the request body you only need to provide Gen Lines. data, not any ID.
Thanks.
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156