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.