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

Community site session details

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

Odata REST Web Services - Not able to Delete Sales Order

(0) ShareShare
ReportReport
Posted on by 51

Hi,

I am creating sales orders through the odata web services. Sometimes the sales lines are missing (other department needs to populate it) and I need to delete the sales order (the sales lines can be empty or have 1 or 2 lines) completely for the time being or else shipping would start working on incomplete SO. I'm using the http DELETE method with sales order number as the filter:

DELETE: URL - NAVSANDBOX.com:7048/.../SalesOrder eq 'SO-2078422'

But I get a 405 saying "'DELETE' requests for 'SalesOrder' of EdmType 'Collection' are not allowed within Microsoft Dynamics NAV OData web services."

Screenshot-from-2019_2D00_12_2D00_10-16_2D00_29_2D00_46.png

Please suggest me how his can be accomplished.

Thanks in advance,

Kishore.

I have the same question (0)
  • Kishore22 Profile Picture
    51 on at
    RE: Odata REST Web Services - Not able to Delete Sales Order

    Got it! Thanks again

    I Gusti Made Ari Permadi

  • I Gusti Made Ari Profile Picture
    3,594 on at
    RE: Odata REST Web Services - Not able to Delete Sales Order

    Yes, it should be working as well. You only need to supply the primary key value . For items primary key is only Number so should be like this Items('1234')

  • Suggested answer
    Kishore22 Profile Picture
    51 on at
    RE: Odata REST Web Services - Not able to Delete Sales Order

    "DELETE http://{{ipandport}}/{{servicename}}/ODataV4/Company('{{companyname}}')/SalesOrder('Order','SO-2078422')"

    is working absolutely fine.

    I Gusti Made Ari Permadi  Thanks a lot!

    Will the same format `SalesOrder('Order','SO-2078422')` work for items/zip codes/customers?

    Like: Items('Item','1234'), Customers('Customer','56787')?

    Thanks again!,

    Kishore.

  • Verified answer
    I Gusti Made Ari Profile Picture
    3,594 on at
    RE: Odata REST Web Services - Not able to Delete Sales Order

    I think the SO number was typo, resource not found means the SO Number  does not exist . Try below :

    DELETE http://{{ipandport}}/{{servicename}}/ODataV4/Company('{{companyname}}')/SalesOrder('Order','SO-2078422')

    You will get response 204 " No Content" when it is successfully deleted

  • Kishore22 Profile Picture
    51 on at
    RE: Odata REST Web Services - Not able to Delete Sales Order

    "DELETE http://{{ipandport}}/{{servicename}}/ODataV4/Company('{{companyname}}')/SalesOrder('Order','SO-2708422')"

    this is not working.

    Error: {

       "error": {

           "code": "BadRequest_ResourceNotFound",

           "message": "Resource not found for the segment 'SalesOrder'."

       }

    }

    Says resource not available. But when I do GET - "SalesOrder?$filter=No eq 'SO-2078422'"

    I get the correct response.

  • Verified answer
    I Gusti Made Ari Profile Picture
    3,594 on at
    RE: Odata REST Web Services - Not able to Delete Sales Order

    For deletion you can  use below call to get one entity only as using $Filter can return collection :

    DELETE http://{{ipandport}}/{{servicename}}/ODataV4/Company('{{companyname}}')/SalesOrder('Order','SO-2708422')

  • Suresh Kulla Profile Picture
    49,099 Super User 2025 Season 2 on at
    RE: Odata REST Web Services - Not able to Delete Sales Order

    You need to specify the ETag, please check the below link and search for ETag

    www.kauffmann.nl/.../

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…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,899 Super User 2025 Season 2

#2
Sumit Singh Profile Picture

Sumit Singh 2,444

#3
Jeffrey Bulanadi Profile Picture

Jeffrey Bulanadi 2,304

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans