You need to sign in to do that
Don't have an account?
inbox outbox 7
How to make a REST call or Apex Web Service?
I need an example with the code.
I just need to know how we send the Unique Message ID or
Unique Record ID in the request.
Please provide me a code
I just need to know how we send the Unique Message ID or
Unique Record ID in the request.
Please provide me a code
@RestResource(urlMapping='/v1/AccountMgmt/')
global class AccountMgmt{
@httpGet
global static Account doGetMethod(){
Account acc= new Account();
Map<String,String> paramsMap = RestContext.request.params;
String accid=paramsMap.get('id');
acc = [select id,name,AnnualRevenue from Account where Id =:accid];
return acc;
}
@httpPost
global static Account doPostMethod(String Name, Integer AnnualRevenue){
Account acc= new Account(Name =name,AnnualRevenue = annualrevenue);
insert acc;
return acc;
}
@httpPut
global static Account doPutMethod(String Name, Integer AnnualRevenue){
Map<String,String> paramsMap = RestContext.request.params;
String accid=paramsMap.get('id');
Account acc= new Account(Name =name, AnnualRevenue = annualrevenue, Id =accid);
update acc;
Kindly mark it as best answer if it helps.Thanks
Hey
Kindly refer this trailhead article which has explained the web service with example :-
https://trailhead.salesforce.com/content/learn/modules/apex_integration_services/apex_integration_webservices
If this help, Kindly mark it as the best answer.
Regards,
Priya Ranjan