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...
Answered

PATCH requests for '' of EdmType 'Collection' are not allowed within Dynamics 365 Business Central OData web services

(2) ShareShare
ReportReport
Posted on by 2

Hello Experts,

I am trying modify the existing record of item journal page using ODATA V4 Service in business central.

We can successfully able to run Get and Post Method But PATCH method not work correct.

Getting Following Error:

    "error": {
        "code""BadRequest_MethodNotAllowed",
        "message""'PATCH' requests for 'Item_Journals' of EdmType 'Collection' are not allowed within Dynamics 365 Business Central OData web services.  CorrelationId:  d43828e7-0c97-44e3-a12c-2d1d03f00b4a."
Request URL:
Body:
{
"Journal_Template_Name": "ITEM",
"Journal_Batch_Name": "D19BF2BD-0",
"Line_No": 10030,
"Entry_Type": "Positive Adjmt.",
"Document_No": "T000001",
"External_Document_No": "",
"Item_No": "1952",
"Location_Code": "",
"Bin_Code": "",
"Quantity": 12
}
pastedimage1587644019906v1.png
Please advice me how to solve this issue?
Thank you in advance
I have the same question (0)
  • Suggested answer
    gert@lynge.org Profile Picture
    on at

    For patch i believe you need to identify a single record with parameters in the URL (just after the webservice name) - not as fields in the body. Like this ...Item_Journals(Journal_Template_Name='ITEM',Journal_Batch_Name='D19BF2BD-0',Line_No=10030)

    If you "understand" powershell i have working examples of the different OData posibilities here: https://scblog.lynge.org/?p=1105

    (the blog is unfortunately in Danish, but the powershell code is in English).

    You'll probably also have to implement the ETag and header If-Match functionality (which secure that you don't modify a record beeing modified by someone else at the same time). You can see how it is done in the powershell

  • Nilesh Gajjar India Profile Picture
    2 on at

    Hi Gert Lynge,

    I have try the same but got error

    API URL:

    api.businesscentral.dynamics.com/.../Item_Journals(Journal_Template_Name='ITEM',Journal_Batch_Name='D19BF2BD-0',Line_No=10030)

    Header

    If-Match          W/\"JzQ0O1RZWUpDK3dJVEpGcjhiekNYTlNpZlZ5NDVNNkdwU2IrdDBJT2VLcnhkcDA9MTswMDsn\"

    Body

    {

    "Journal_Template_Name": "ITEM",
    "Journal_Batch_Name": "D19BF2BD-0",
    "Line_No": 10030,
    "Entry_Type": "Positive Adjmt.",
    "Document_No": "T000001",
    "External_Document_No": "",
    "Item_No": "1952",
    "Location_Code": "",
    "Bin_Code": "",
    "Quantity": 12
    }

    Got this error

        <code>RequestDataInvalid</code>
        <message>Request data is invalid.</message>
    </error>
    pastedimage1587650121276v1.png
    Any suggestion?
  • Suggested answer
    gert@lynge.org Profile Picture
    on at

    I don't think you should include the Journal_Template_Name, Journal_Batch_Name and Line_No in the body.

    Only include the fields you want to change the value of.

    Also: Your ETag does not look correct. Note that the backshashes in powershell is probably for escaping the " characters.

    I think it should look like this: W/"'JzQ0O1RZWUpDK3dJVEpGcjhiekNYTlNpZlZ5NDVNNkdwU2IrdDBJT2VLcnhkcDA9MTswMDsn'" 

  • Nilesh Gajjar India Profile Picture
    2 on at

    This time i only include the quantity in body part still it give same error as bad request

    pastedimage1587650895868v1.png

  • Suggested answer
    gert@lynge.org Profile Picture
    on at

    Can you try without the If-Match header just to see if it is formatted correctly? (you should get another error then).

  • Nilesh Gajjar India Profile Picture
    2 on at

    Without If-Match header

    Get below error

    pastedimage1587651412785v1.png

  • Suggested answer
    gert@lynge.org Profile Picture
    on at

    Ok. Then it complains the If-Match is missing - but that tells us the rest of the request apparently is ok.

    Try to re-add it, but remove the backslashes from it...

  • Nilesh Gajjar India Profile Picture
    2 on at

    I have add If-Match tag again remove all back and forward slash but got same error

    pastedimage1587651944299v1.png

  • Nilesh Gajjar India Profile Picture
    2 on at

    Does anyone confirm that PATCH method work for ODATA Service in Business Central?

  • Suggested answer
    gert@lynge.org Profile Picture
    on at

    I don't think you should remove the forward slashes - only the backslashes which is for escaping the " in powershell

    Actually i think the format is like this: W/"'JzQ0O1RZWUpDK3dJVEpGcjhiekNYTlNpZlZ5NDVNNkdwU2IrdDBJT2VLcnhkcDA9MTswMDsn'" 

    Please try that

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 2,468

#2
YUN ZHU Profile Picture

YUN ZHU 923 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 607

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans