web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

journalLines API throwing error

(0) ShareShare
ReportReport
Posted on by 5

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.

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,700 Moderator on at

    Hi,

    In the request body you only need to provide Gen Lines. data, not any ID.

    Thanks.

  • t3chlady Profile Picture
    5 on at

    I get the same error without an id

  • Suggested answer
    Nitin Verma Profile Picture
    21,700 Moderator on at

    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.

  • t3chlady Profile Picture
    5 on at

    I did pass all of the fields you mention but still am getting the error.

  • Suggested answer
    Marco Mels Profile Picture
    on at

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,151

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,443 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,092 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans