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.

  • Suggested answer
    Marco Mels Profile Picture
    on at
    RE: journalLines API throwing error

    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.

  • t3chlady Profile Picture
    5 on at
    RE: journalLines API throwing error

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

  • Suggested answer
    Nitin Verma Profile Picture
    21,569 Moderator on at
    RE: journalLines API throwing 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.

  • t3chlady Profile Picture
    5 on at
    RE: journalLines API throwing error

    I get the same error without an id

  • Suggested answer
    Nitin Verma Profile Picture
    21,569 Moderator on at
    RE: journalLines API throwing error

    Hi,

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

    Thanks.

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,655

#2
Mansi Soni Profile Picture

Mansi Soni 1,574

#3
YUN ZHU Profile Picture

YUN ZHU 1,453 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans