You need to sign in to do that
Don't have an account?
ManojKumar Muthu
Unexpected parameter encountered during deserialization for case attachment
HI there,
Below my code was working fine, but suddenly pass an error, when I try to attach a document,
Custom API for Case Attachment,
@RestResource(urlMapping='/CaseAttachment/*')
global with sharing class CaseAttachment{
@HttpGet
global static List<Attachment> getCaseById() {
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
String Id = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
List<Attachment> result = [Select id, Name, OwnerId, BodyLength, LastModifiedById, LastModifiedDate, ContentType, Body, Description, CreatedDate, CreatedById from Attachment where ParentId = :Id];
return result;
}
@HttpPost
global static void doget(String type, String body, String ContentType, String ParentID){
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
if(Test.isRunningTest()){
String CaseName=req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
//String doc=EncodingUtil.Base64Encode(req.requestBody);
}
Attachment a = new Attachment();
a.Name = type;
a.Body = Blob.valueOf(body);
a.ContentType = ContentType;
a.ParentId = ParentID;
insert a;
}
}
Below the resultCan someone help with this asap.
Below my code was working fine, but suddenly pass an error, when I try to attach a document,
Custom API for Case Attachment,
@RestResource(urlMapping='/CaseAttachment/*')
global with sharing class CaseAttachment{
@HttpGet
global static List<Attachment> getCaseById() {
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
String Id = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
List<Attachment> result = [Select id, Name, OwnerId, BodyLength, LastModifiedById, LastModifiedDate, ContentType, Body, Description, CreatedDate, CreatedById from Attachment where ParentId = :Id];
return result;
}
@HttpPost
global static void doget(String type, String body, String ContentType, String ParentID){
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
if(Test.isRunningTest()){
String CaseName=req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
//String doc=EncodingUtil.Base64Encode(req.requestBody);
}
Attachment a = new Attachment();
a.Name = type;
a.Body = Blob.valueOf(body);
a.ContentType = ContentType;
a.ParentId = ParentID;
insert a;
}
}
Below the resultCan someone help with this asap.
All Answers
Now its working fine