global static String updateCase(RestRequest req)
        string cname = req.params.get('Accountname');
        Account acc =[Select ID, Name, Type, BillingState from Account where Name = :cname];
         Attachment a = new Attachment();
        insert a;
        return 'process success';

I get invaluid type Http method: system.restrequest error in this code ,i dont kno how to solve it

  • Can you post whole code that you wrote.It will be helpful to go through.Including how you declared class and also the REST context system classes – Mohith Shrivastava Jul 10 '13 at 12:04
  • hi mohith i got my code working ,check my answer – Manoj Chandran Jul 10 '13 at 12:36

The way that RestRequest and RestResponse are accessed changed in api version 24.0 so any code with version 24.0 or later will need to access them using the new RestContext object:

global Static Map<String,String> doPut() {
    RestRequest req = RestContext.request;
    RestResponse res = RestContext.response;

The old way was

global Static Map<String,String> doPut(RestRequest req, RestResponse res){}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.