@RestResource(urlMapping='/Account13/*')
global with sharing class MyRestResource13 {
@HttpPost
global static string sendAccount(){
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
system.debug(req);
system.debug(res);
// map<account,object> account1 = new map<account,object>();
Blob body = req.requestBody;
system.debug(body);
string body1 =body.toString();
system.debug(body1);
dto df = (dto)json.deserialize(body1 ,dto.class);
dto dl = new dto(df.name,df.phone,df.website);
system.debug(df);
Account a = new account();
//a.name=df.name;
insert a;
system.debug(dl);
return json.serialize(dl);
}
public class dto
{
public string Name{get;set;}
public string phone{get;set;}
public string website{get;set;}
public dto(String Name,String phone,String Website)
{
this.Name=Name;
system.debug(Name);
this.phone=phone;
system.debug(phone);
this.website=website;
system.debug(website);
}
}
}
If we Change the Annotations @Httpput and @Httpget also it is Working,then what is the difference between put,get and post,Please anyone Explain with above Code