Activity › Forums › Salesforce® Discussions › What is the use of httpPATCH in Salesforce?
Tagged: Http, Http Patch, Patch, Patch Org, Patch Versions in Salesforce
-
What is the use of httpPATCH in Salesforce?
Posted by Sanjana on July 5, 2018 at 1:41 PMWhat is the use of httpPATCH in Salesforce?
shariq replied 7 years, 8 months ago 4 Members · 3 Replies -
3 Replies
-
Hi Sanjana,
HttpPatch methods are used to do update operation in Salesforce. You have to write class with @httpPatch method which will be used by end user.
- [adinserter block='9']
-
Hi
HttpPatch Annotation.
The @HttpPatch annotation is used at the method level and enables you to expose an Apex method as a REST resource. This method is called when an HTTP PATCH request is sent, and updates the specified resource. To use this annotation, your Apex method must be defined as global static.
THanks
-
Hi,
HttpPatch methods are used to do update operation in salesforce. You have to write class with @httpPatch method which will be used by end user.
Please refer this:
@RestResource(urlMapping=’/jaichaturvedirestexample/*’)
global with sharing class RESTClass{@HttpPatch //use patch for updating record in database. we have to pass record id to fecth it from database and then update it.
global static String updateAccount(string accnumber){
String accid1 = RestContext.request.params.get(‘id’);
Account acc = [select accountnumber from account where id =: accid1];
acc.accountnumber = accnumber;
update acc;
return ‘account updated’;
}}
Here end user have to pass account number ot update account record.
Hope this helps.
Log In to reply.