I have created a method to update the records in a case.

@RestResource(urlMapping= '/FieldCases/*')
global with sharing class RestCaseController {
    global static String caseUpdate(String caseId, String caseStatus, String caseNote){
        Case companyCase = [SELECT Id, Subject, Status, Description FROM Case WHERE Id = :caseId];

        companyCase.Status = caseStatus;
        companyCase.Description += caseNote;
        update companyCase;

        Return 'Updated';

and in work bench I am using


{"caseId" : "0037F00000bQYIjQAO",
 "caseStatus" : "Working",
 "caseNote" : "updating from the work bench"} 

but I am getting the below error

HTTP Method 'PATCH' not allowed. Allowed are POST,DELETE,GET,HEAD

  • I think you need to pass CaseID also in URL. Like this : /services/apexrest/FieldCases/0037F00000bQYIjQAO
    – Mr.Frodo
    Jun 2 '18 at 7:58
  • Thank you so much for responding but the error is still the same :(
    – gs650x
    Jun 2 '18 at 8:02
  • @gs650x looks like issue with workbench. Can you try it in postman? Jun 2 '18 at 11:44

Hey I tried it myself with workbench and it seems to be working for me, I am posting screenshots here:

Apex class

Workbench result

API Version could be the issue in your case, Try changing your Apex class to latest api version.

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.