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...
Suggested Answer

How to send Response message in PATCH Method Api in Business central [On Cloud]

(0) ShareShare
ReportReport
Posted on by 256

Hi All,

I have create list page of Customize table and published  as web service on Business central. Using that web service URL I have to updated the some field in table  using PATCH  method but I want send response as "Success", Or "Failed".  so where i can change so it send response message.

Thanks in Advanced.

   

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

    Explanation on controlling the response plus other points can be seen here: www.kauffmann.nl/.../

  • NeoMatrix Profile Picture
    256 on at

    Thank for Reply.  I'll go through link but I have not found send response for PATCH method.  Can you have any example. Because In my PATCH method it send response as following

    "@odata.context": "https://api.businesscentral.dynamics.com/v2.0/4dfdfdfb9cc8-aee1-4b91-beb8-d775490e1/Sandbox_New/ODataV4/$metadata#Company('Test')/TestInfo/$entity",
        "@odata.etag": "W/\"JzQ0O3Q0S2puK2jRS9BNmN5MjZ2aGpG9MTswMDsn\"",
        "Document_Type": "Quote",
        "DocumentNo": "SORD10100",
        "LineNo": 2500,
        "ItemQuantity": 0,
        "UpdateQuantity": 200,
        "ShiptoCode": "IN",
        "TotalWeight": 40

    But I want to send response as below

    {

    status : "Success"

  • gradient Profile Picture
    120 on at

    Hi,

    When you work with any API your HttpResponseCode gives you if this was success or failed:

    • 1xx: informational response - indicates that the request was received and understood
    • 2xx: successful response - indicates the action requested by the client was received, understood and accepted
    • 3xx: redirection - indicates the client must take additional action to complete the request
    • 4xx: client error - indicates there was an error, that seems to have been caused by the client
    • 5xx: server error - indicates that an error happened on the server.

    If you want to manipulate the response please have a look at WebServiceActionContext and OnModify trigger (it is fired on PATCH).

    If that is not working maybe you will have to use bound action for updating record which may look something like (not tested):

    updateRec(value: Code[10]; var ctx: WebServiceActionContext)
    
    begin
    
     // your code here
    
    end

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,664

#2
YUN ZHU Profile Picture

YUN ZHU 960 Super User 2025 Season 2

#3
Jainam M. Kothari Profile Picture

Jainam M. Kothari 773 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans