Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Answered

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

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
Categories:
  • SR-12092246-0 Profile Picture
    SR-12092246-0 4 on at
    PATCH requests for '' of EdmType 'Collection' are not allowed within Dynamics 365 Business Central OData web services
    The PATCH still dioes not work..
    I am trying to update 1 field in the vendors table.
    TableID = 23
    Primary key = No (VendorID)
    There are no other PKs for this table.
    The PATCH did not work in my java code if I used It did not work with If-match = etag
    The PATCH did not work in my java code if I used It did not work without If-match 
    The PATCH did not work in my java code if I used It did not work with If-match = the PK VendorID as well.
     
  • PATCH requests for '' of EdmType 'Collection' are not allowed within Dynamics 365 Business Central OData web services
    Hola, espero te encuentres muy, efectivamente no podemos usar ni PATCH ni PUT, pero después de realizar muchas pruebas lo único que hay que hacer es tener un post con  todos los datos, lo que haces es remplazar los valores por los nuevos que quieres remplazar y lanza el id principal del proceso que realices y de este modo ya podrás actualizar y no te crea nuevos datos. 
  • Fisher A Profile Picture
    Fisher A 25 on at
    RE: PATCH requests for '' of EdmType 'Collection' are not allowed within Dynamics 365 Business Central OData web services

    My Patch command: api.businesscentral.dynamics.com/.../Resources(No='res1')

    {

     "Unit_Cost": 15

    }

    i set the If-Match, and i get Entity does not support modifying data

  • Suggested answer
    Olister Rumao Profile Picture
    Olister Rumao 3,957 on at
    RE: PATCH requests for '' of EdmType 'Collection' are not allowed within Dynamics 365 Business Central OData web services

    Hi,
    I belive that you are passing a value that is expected to be EDM.
    Can you just try passing primary keys and step-by-step adding fields?

    Thanks.

  • Simon Costa Profile Picture
    Simon Costa 5 on at
    RE: PATCH requests for '' of EdmType 'Collection' are not allowed within Dynamics 365 Business Central OData web services

    Can you please help me with the POST method? How did you successfully get this request?

  • adityamohite Profile Picture
    adityamohite 77 on at
    RE: PATCH requests for '' of EdmType 'Collection' are not allowed within Dynamics 365 Business Central OData web services

    Hi Nilesh,

    I tried using the same If-match and e-tag format to update a Customer, but getting error: 

    {
        "error":
     {
            "code""BadRequest_MethodNotAllowed",
            "message""Entity does not support modifying data.  CorrelationId:  6d555282-5f62-4980-80e9-16c120972f03."
      }
    }
    pastedimage1604137185091v1.png
    Please advise me on how to resolve this issue?
  • RE: PATCH requests for '' of EdmType 'Collection' are not allowed within Dynamics 365 Business Central OData web services

    Hi Olister Rumao

    Thank you for response.

    i have already solve the issue and now all method works fine for ODATA Service.

    GET

    POST

    PATCH

    DELETE

  • Suggested answer
    Olister Rumao Profile Picture
    Olister Rumao 3,957 on at
    RE: PATCH requests for '' of EdmType 'Collection' are not allowed within Dynamics 365 Business Central OData web services

    Hi Nilesh,

    Use If-Match = *

    Select Record using APIBaseAddress/ItemJournals(PRIMARY KEYS SEPERATED WITH COMMAS)

    A best way to verify is call the URL in GET first and see if you can just find that record.

    Then, change method to PATCH, Add  Content-Type, If-Match and pass your data as Json body.

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

    Yes, DELETE method works. Thanks again.

  • Verified answer
    RE: PATCH requests for '' of EdmType 'Collection' are not allowed within Dynamics 365 Business Central OData web services

    Sure method DELETE. You should include an ETag, but no body. Record primary key fields should be included as parameters, just like you did with PATCH.

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,277 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,126 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans