function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DJ 367DJ 367 

Cannot deserialize instance of base64 from START_OBJECT value { or request may be missing a required field at [line:6, column:26]

Hello All,

I am getting this error on REST API while sending attachment.Any help

calling callout from save method
List<Attachment> lstEmailAttachment = [select Name, body,contentType from Attachment where parentId IN: lstId]
 
   String jsonString = JSON.serializePretty(lstEmailAttachment);
   callout(jsonString,jsonStringWS);

this code is in callout method- here I am getting the error 
 
List<Attachment> documentLst = (List<Attachment>)System.JSON.deserialize(jsonString,List<Attachment>.class);



 
Khan AnasKhan Anas (Salesforce Developers) 
Hi,

Greetings to you!

Please refer to the below links with a similar discussion which might help you further with the above issue.

https://salesforce.stackexchange.com/questions/111405/unable-to-deserialize-salesforce-attachment-exception-thrown

https://developer.salesforce.com/forums/?id=906F0000000946SIAQ

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas