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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

MS Dynamics 365 Business Central. API POST, PATCH, DELETE does not work

(0) ShareShare
ReportReport
Posted on by 10

We have installed on our server MS Dynamics 365 Business Central (I don't know how to view currently installed version). We are using oData v4 protocol for our requests.

Task

We need to make API calls to this system from PHP

Issue

It's impossible to make POST, PATCH, DELETE requests when GET request works well.

GET

Request:

GET d365bc.vendor.com:7058/.../Customer

Response

{
    "@odata.context": "">d365bc.vendor.com:7058/.../$metadata,
    "value": [
        {
            "@odata.etag": "W/\"JzQ0O29EcmJmcGs4V3NRMHlEQ0Fxa0JxL1N0bi9xZjY5UDFQakZ0U2tBUGU1Kzg9MTswMDsn\"",
            "No": "01121212",
            "Name": "Spotsmeyer's Furnishings",
            "Responsibility_Center": "",
            "Location_Code": "YELLOW",
            "Post_Code": "US-FL 37125",
            "Country_Region_Code": "US",
            "Phone_No": "",
            "IC_Partner_Code": "",
            "Contact": "Mr. Mike Nash",
            "Salesperson_Code": "JR",
            "Customer_Posting_Group": "FOREIGN",
            "Gen_Bus_Posting_Group": "EXPORT",
            "VAT_Bus_Posting_Group": "EXPORT",
            "Customer_Price_Group": "",
            "Customer_Disc_Group": "",
            "Payment_Terms_Code": "1M(8D)",
            "Reminder_Terms_Code": "FOREIGN",
            "Fin_Charge_Terms_Code": "2.0 FOR.",
            "Currency_Code": "USD",
            "Language_Code": "ENU",
            "Search_Name": "SPOTSMEYER'S FURNISHINGS",
            "Credit_Limit_LCY": 0,
            "Blocked": " ",
            "Privacy_Blocked": false,
            "Last_Date_Modified": "2020-06-18",
            "Application_Method": "Manual",
            "Combine_Shipments": true,
            "Reserve": "Optional",
            "Shipping_Advice": "Partial",
            "Shipping_Agent_Code": "",
            "Base_Calendar_Code": "",
            "Balance_LCY": 0,
            "Balance_Due_LCY": 0,
            "Sales_LCY": 0,
            "Global_Dimension_1_Filter": "",
            "Global_Dimension_2_Filter": "",
            "Currency_Filter": "",
            "Date_Filter": "..11/13/20"
        },
        {
            "@odata.etag": "W/\"JzQ0O08vNlVHSWVaZ1FGeG42d2JOa3k4Qm5uVHlkSGYzNk1ES2V5Y2E2S3hiekU9MTswMDsn\"",
            "No": "01445544",
            "Name": "Progressive Home Furnishings",
            "Responsibility_Center": "",
            "Location_Code": "YELLOW",
            "Post_Code": "US-IL 61236",
            "Country_Region_Code": "US",
            "Phone_No": "",
            "IC_Partner_Code": "",
            "Contact": "Mr. Scott Mitchell",
            "Salesperson_Code": "JR",
            "Customer_Posting_Group": "FOREIGN",
            "Gen_Bus_Posting_Group": "EXPORT",
            "VAT_Bus_Posting_Group": "EXPORT",
            "Customer_Price_Group": "",
            "Customer_Disc_Group": "RETAIL",
            "Payment_Terms_Code": "14 DAYS",
            "Reminder_Terms_Code": "FOREIGN",
            "Fin_Charge_Terms_Code": "2.0 FOR.",
            "Currency_Code": "USD",
            "Language_Code": "ENU",
            "Search_Name": "PROGRESSIVE HOME FURNISHINGS",
            "Credit_Limit_LCY": 0,
            "Blocked": " ",
            "Privacy_Blocked": false,
            "Last_Date_Modified": "2018-09-19",
            "Application_Method": "Manual",
            "Combine_Shipments": true,
            "Reserve": "Optional",
            "Shipping_Advice": "Partial",
            "Shipping_Agent_Code": "",
            "Base_Calendar_Code": "",
            "Balance_LCY": 1499.03,
            "Balance_Due_LCY": 1499.03,
            "Sales_LCY": 1499.03,
            "Global_Dimension_1_Filter": "",
            "Global_Dimension_2_Filter": "",
            "Currency_Filter": "",
            "Date_Filter": "..11/13/20"
        },

DELETE

DELETE https://d365bc.vendor.com:7058/attain/ODataV4/Company('{{company}}')/Customer(No='01121212')
{
    "error": {
        "code": "BadRequest",
        "message": "Entity does not support delete."
    }
}

I'm not sure what is the correct syntax for the Create (POST) or Update (Patch) For the POST request I tried to copy existing value (taken from GET) and put it into the body. I'm getting following response:

{
    "error": {
        "code": "BadRequest_MethodNotAllowed",
        "message": "Entity does not support insert."
    }
}

Sometimes if I make absolutely wrong request I'm getting following response:

{
    "error": {
        "code": "BadRequest_MethodNotAllowed",
        "message": "'POST' requests for 'Customer' of EdmType 'Entity' are not allowed within Microsoft Dynamics 365 Business Central OData web services."
    }
}

I'm unable to apply CUD operations for Customers, ProductItems. However for orders it works.

Existing Privileges

If I follow

Setup & Extensions / Manual Setup / Users / [Select User]

In the permissions section, there are too many assigned privileges. Among them, there is a SUPER privileges item. As I know all names are custom there. Here is the screenshot of the assigned privileges.

pastedimage1605276720714v1.png

I have the same question (0)
  • Suggested answer
    JAngle Profile Picture
    159 on at

    I would use a different web service. Try page 21. It is the customer card page so it will interact over a web service like it would in the UI. All the commands you need work with that one.

    For PATCH use a If-Match of at least * in the header. If you can pass in the odata etag of the record something like: 

    "@odata.etag": "W/\"JzQ0O0xEMjFoeGlsRkxjd2IzZ0hFMjFYYlVCbnZUVmJad0MxQktib0Z2bjRKeFE9MTswMDsn\""
    Also the regular customer API could be used it just includes less fields than the mentioned page.
  • Suggested answer
    raelhefn Profile Picture
    Microsoft Employee on at
  • Zhartaunik Profile Picture
    10 on at

    Hi Josh

    Please advise, 21st page of what? Can you share the document you mean?

    Is there anywhere a valid list of endpoints to make API calls?

    Does DELETE or POST either need this header? As for my case, even if I add the necessary header I will receive an error like this (which differs from that one with an invalid If-Match header):

    "message": "'PATCH' requests for 'Customer' of EdmType 'Collection' are not allowed within Microsoft Dynamics 365 Business Central OData web services."

  • Suggested answer
    JAngle Profile Picture
    159 on at

    Just knowledge of the product but I also tested this for you. Publishing web services can be viewed here: docs.microsoft.com/.../publish-web-service

    That error is purely down to the end point chosen. If you can’t do what you need with an end point you will often need to find an alternative page or create your own to bend the rules. Some of the pages will have properties to prevent insert, modify, delete etc.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 647 Super User 2026 Season 1

#2
Gerardo RenterĂ­a GarcĂ­a Profile Picture

Gerardo RenterĂ­a Ga... 447 Most Valuable Professional

#3
YUN ZHU Profile Picture

YUN ZHU 366 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans