Below is a simple example of a rest web service (RestWSSampleWithParam) with a web method (getRestSampleResponse)contains parameters.
/** * Rest Web Service Example. **/ @RestResource(urlMapping='/RestWSSampleParamExmpl/*') global with sharing class RestWSSampleWithParam { @HttpPost global static String getRestSampleResponse(String firstName, String lastName) { return 'Hello! ' + firstName + ' ' + lastName; } }