i wrote a rest service i am inserting 2 fields if i get any null value for any field i have to send the JSON response to the third party server can any one suggest me where i have to change my service to send the response
webservice :
@RestResource(urlMapping='/Account/*')
global with sharing class AccntController{
@HttpPost
global static String createaccnt(List<ACCaccnts>AccList)
{
List<Account> AccountList = new List<Account>();
if(AccList!=null){
for(ACCaccnts acc: AccList){
Account tc = new Account();
tc.Name = acc.accName;
tc.accJson__c = acc.json;
AccountList.add(tc);
}
}
if(!AccountList.isempty())
insert AccountList;
return null;
}
global class ACCaccnts{
global String json;
global String accName;
}
}