You need to sign in to do that
Don't have an account?
Rest resource NewWeb service requires test method
Hi All Friends,
I wrote a new REST Web service which works well for an update while calling from out side.
But not able to package it,because it required test methods.
The below is the REST web service written in apex class.Please help write test methods.
Thanks
Pradeep
@RestResource(urlMapping='/Contacts/*')
global with sharing class MyRestResource {
@HttpPost
global static String doPost(RestRequest req, RestResponse res, String NPS)
{
String contactId= req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
Contact contact= [SELECT AccountID,NPS__c FROM Contact WHERE Id=:contactId];
contact.NPS__c= NPS; update contact; return contact.NPS__c;
}
}