salesforce lightning, 1. Create connected app and generate user secret and key 2. Give Full access for this project under connected app permission 3. Create your apex class and test in workbench://use this url to call from workbench /services/apexrest/GetCase2/5009000001NxD87 Apex code @RestResource(urlMapping='/GetCase2/*') global with sharing class RestCaseCreatorurl { @HttpGet global static Case getCaseById() { RestRequest request = RestContext.request; // grab the caseId from the end of the URL String caseId = request.requestURI.substring(request.requestURI.lastIndexOf('/')+1); Case result = [SELECT CaseNumber,Subject,Status,Origin,Priority FROM Case WHERE Id = :caseId]; return result; } @HttpPost global static String createcase1(String status, String origin){ Case cs = new Case(); cs.Status = status; cs.Origin = origin; insert cs; return cs.
#wowwow
ReplyDelete