I have created a method to update the records in a case.
@RestResource(urlMapping= '/FieldCases/*')
global with sharing class RestCaseController {
@HttpPatch
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
/services/apexrest/FieldCases
{"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
Best Answer
Hey I tried it myself with workbench and it seems to be working for me, I am posting screenshots here:
API Version could be the issue in your case, Try changing your Apex class to latest api version.