• Fast Cloud Consulting
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi guys, 
I want to convert and REST API web-service synchronous to queable-
Here is the code which is perfectly worked for upload attachment upto 5.5 MB 64 encoded file. And I see in the document we can upload upto 12MB if this is in asynchronous in nature. 
 
@RestResource(urlMapping='/insertCaseWithAttachmentRestService/*')
global with sharing class insertCaseWithAttachmentRestAPI {
    //In this method we insert case with multiple attached files
   @httpPost
    global static Id insertCase(caseRequest req){
        Case caseObj = new Case();
        caseObj.Product__c = req.pdt;
        caseObj.Type = req.type;
        caseObj.Status = req.status;
        caseObj.Origin = req.origin;
        caseObj.Subject = req.subject;
        insert caseObj;
        system.debug('CaseId->>>>'+caseObj.Id);
        
        List<Attachment> attList = new List<Attachment>();
      
        for(attachmentRequest att : req.attList){
            attList.add(new Attachment(Name=att.attachmentName, 
                                      Body=EncodingUtil.base64Decode(att.blobString),
                                      ParentId=caseObj.Id
                                      ));
        }
        insert attList;
        
        return caseObj.Id;  
    }
    //Wrapper class
    global class caseRequest{
        String pdt {get; set;}
        String type {get; set;}
        String status {get; set;}
        String origin {get; set;}
        String subject {get; set;}
        
        List<attachmentRequest> attList {get; set;}
    }
    global class attachmentRequest{
        String attachmentName {get; set;}
        String blobString {get; set;}
    }
}

Any help to convert this into queueable interface?

Thanks in advance