You need to sign in to do that
Don't have an account?
Subhasini Bhosal 6
I am not sure how to use REST API to update a Case record by passing the the updated value in JSON format. For instance if I want to update the priority of an existing case from High to Low. Can somebody help on this?
HI ,
I have written written apex class to create a case and return a case by Id using REST API and JSON.I am not sure how to use REST API to update a Case record by passing the the updated value in JSON format. For instance if I want to update the priority of an existing case from High to Low. Can somebody help on this?
-------------------------------------------
@RestResource(urlMapping='/Case/*')
global with sharing class CaseCreater {
@HttpGet
global static Case getCaseById() {
RestRequest req = RestContext.request;
String caseId = req.requestURI.substring(
req.requestURI.lastIndexOf('/')+1);
Case result =
[SELECT Status,Origin from Case where Id = :caseId];
return result;
}
@HttpPost
global static String createCase(String priority,String type, String status,
String origin,String reason, String subject, String description ) {
Case c = new Case(
Priority=priority,
Type= type,
Status=status,
Origin=origin,
Reason=reason,
Subject=subject,
Description=description
);
insert c;
return c.Id;
}
}
//SELECT Status,Origin,priority,Product__c,Type,Reason,
//Subject,Description,account.name,case.contact.name from Case where status='New'
I have written written apex class to create a case and return a case by Id using REST API and JSON.I am not sure how to use REST API to update a Case record by passing the the updated value in JSON format. For instance if I want to update the priority of an existing case from High to Low. Can somebody help on this?
-------------------------------------------
@RestResource(urlMapping='/Case/*')
global with sharing class CaseCreater {
@HttpGet
global static Case getCaseById() {
RestRequest req = RestContext.request;
String caseId = req.requestURI.substring(
req.requestURI.lastIndexOf('/')+1);
Case result =
[SELECT Status,Origin from Case where Id = :caseId];
return result;
}
@HttpPost
global static String createCase(String priority,String type, String status,
String origin,String reason, String subject, String description ) {
Case c = new Case(
Priority=priority,
Type= type,
Status=status,
Origin=origin,
Reason=reason,
Subject=subject,
Description=description
);
insert c;
return c.Id;
}
}
//SELECT Status,Origin,priority,Product__c,Type,Reason,
//Subject,Description,account.name,case.contact.name from Case where status='New'
Can you add one more method.
Let me know if you need more help.
Thanks,
Naval