Apex class -
@RestResource(urlMapping='/account')
global class createAccount
{
@HttpPost
global static void createAcc()
{
//-- Data coming from request
String strFirstName = RestContext.request.params.get('First_Name');
String strLastName = RestContext.request.params.get('Last_Name');
String strPhone = RestContext.request.params.get('Phone');
String strEmail = RestContext.request.params.get('Email');
String strTitle = RestContext.request.params.get('Title');
system.debug('RestContext.request.params: '+RestContext.request.params);
system.debug('First_Name: '+strFirstName);
system.debug('Last_Name: '+strLastName);
system.debug('Phone: '+strPhone);
system.debug('Email: '+strEmail);
system.debug('Title: '+strTitle);
}
}
When I check the debug log, the last debug statement shows null value.
12:17:31.033 (33840000)|USER_DEBUG|[21]|DEBUG|RestContext.request.params: {[email protected], First_Name=FirstName, Last_Name=LastName, Phone=+1234567890, Title=Mr}
12:17:31.033 (33886000)|USER_DEBUG|[23]|DEBUG|First_Name: FirstName
12:17:31.033 (33929000)|USER_DEBUG|[24]|DEBUG|Last_Name: LastName
12:17:31.033 (33963000)|USER_DEBUG|[25]|DEBUG|Phone: +1234567890
12:17:31.033 (33998000)|USER_DEBUG|[26]|DEBUG|Email: [email protected]
12:17:31.034 (34035000)|USER_DEBUG|[27]|DEBUG|Title: null