This is a sample Hello APIhttp://api.example.comhttp://lbroudoux-OSX.local:8089/Get a new greeting message
Get a new greeting messagenameQUERYName of people to greetapplication/xml200application/json200application/xml405application/json405http://api.example.comNo AuthorizationTestSuite generated for REST Service [Hello API]SEQUENTIALTestCase generated for REST Resource [/hello] located at [/hello]http://lbroudoux-OSX.local:8089/http://lbroudoux-OSX.local/v1/hello200greetingHello David !falsefalsefalse200No AuthorizationUTF-8http://lbroudoux-OSX.local:8089/http://lbroudoux-OSX.local/v1/hello200greetingHello Gavin !falsefalsefalse200No Authorizationversion0.8Unknwon ResponseSCRIPT// Script dispatcher is used to select a response based on the incoming request.
// Here are few examples showing how to match based on path, query param, header and body
// Match based on query parameter
def queryString = mockRequest.getRequest().getQueryString()
log.info "QueryString: " + queryString
if( queryString.contains("David") )
{
// return the name of the response you want to dispatch
return "David Response"
}
else if( queryString.contains("Gavin") )
{
// return the name of the response you want to dispatch
return "Gavin Response"
}
else return "Unknown Response"{
'name':'David',
'greeting':'Hello David !'
}
{
'name':'Gavin',
'greeting':'Hello Gavin !'
}