Saturday, 20 October 2012

How to attach an image as an attachment to the parent object using REST API of force.com when image come from client as base64 encoded Text in JSON request

The REST API's offered by the force.com platform has matured lot since previous three versions and this makes it exiting for the integration with other system supporting JSON in their API's
I was reading an article by Sandeep Bhanot(I personally feel he is one of the best in salesforce evangelism) on the platform's ability to deserialise the base 64 encoded image and also decode it .
Here is the link to the article Using Binary Data With REST
Unfortunately my client app(ipad app)was using older version of REST kit that comes along with SDK and they feared upgrading to the newer version
Hence the design was altered to pass the base64 encoded text in the JSON request.Following is the code snippet that we need to decode the binary base 64 encoded image and attach as an attachment to the necessary parent object in sfdc
@RestResource(urlMapping='/Callmanagement/v1/*')
global with sharing class SFA_DoctorsignPoc {
    
@HttpPost
global static String attachdoctorsSign(String encodedSignature){
          
RestRequest req = RestContext.request;
Id callId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
Blob pic ;//Blob variable to capture decoded image
if(encodedsignature!=null) {
pic=EncodingUtil.base64Decode(encodedSignature);//Decode the base64 encoded image 
 }
Attachment a = new Attachment (ParentId = callId,
Body = pic,
ContentType = 'image/png',
Name = 'Doctors Signature');
insert a;
return a.Id;
    }
}
Now comes the testing part and good news is that we can use workbench to test this as well
To test this open the workbench REST utility and then you can post the JSON request body
Here is the example request body
{
"encodedSignature":"iVBORw0KGgoAAAANSUhEUgAAAogAAAFACAIAAACweBqpAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAJnNJREFUeF7tncHSA7ltBp0nSary/g+WSlVy9HEjW45WK2mGIAGSH8BO+RSTINDgsIfza9f/9scff/yN/4MABCAAAQhAQITAQ8z8HwQgAAEIQAACIgT+JpIHaUAAAhCAAAQg8I/P2FCAAAQgAAEIQECHAGLW6QWZQAACEIAABLgxswcgAAEIQAACSgS4MSt1g1wgAAEIQOB4Aoj5+C0AAAhAAAIQUCKAmJW6QS4QgAAEIHA8AcR8/BYA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EIACBLAQs0rWMyVIveQYSiBRzYFqEggAEIJCaQFO6zQGpyyd5DwHE7KHHXAhAAAK/CTS92xwA2WMJIOZjW0/hEIDAXAL3/ygUYp5LP3N0xJy5e+QOAQgIE7hRr/HXYcLFkdpEAoh5IlxCQwACJxP4Kearf7L0ZFDU/kEAMbMlIAABCEwh0PVvd5iSAUFzEkDMOftG1hCAgDwBxCzfItEEEbNoY0gLAhAoQMDo5gKVUkIgAcQcCJNQEIAABP5CwCJmkEGAvzGzByAAAQisI8CvvdaxrrISN+YqnaQOCEBAkgD/vLJkW6STQszS7SE5CEAAAhA4jQBiPq3j1AsBCEAAAtIEELN0e0gOAhCAAAROI4CYT+s49UIAAhCAgDQBxCzdHpKDAAQgAIHTCCDm0zpOvRCAAAQgIE0AMUu3h+QgAAEIQOA0Aoj5tI5TLwQgAAEISBNAzNLtITkIQAACEDiNAGI+rePUCwEIQAAC0gQQs3R7SA4CEIAABE4jgJhP6zj1QgACEICANAHELN0ekoMABCAAgdMIIObTOk69EIAABCAgTQAxS7eH5CAAAQhA4DQCiPm0jlMvBCAAAQhIE0DM0u0hOQhAAAIQOI0AYj6t49QLAQhAAALSBBCzdHtIDgIQgAAETiOAmE/rOPVCAAIQgIA0AcQs3R6SgwAEIACB0wgg5tM6Tr0QgAAEICBNADFLt4fkIAABCEDgNAKI+bSOUy8EIAABCEgTQMzS7SE5CEAAAhA4jQBiPq3j1AsBCEAAAtIEELN0e0gOAhCAAAROI4CYT+s49UIAAhCAgDQBxCzdHpKDAAQgAIHTCCDm0zpOvRCAAAQgIE0AMUu3h+QgAAEIQOA0Aoj5tI5TLwQgAAEISBNAzNLtITkIQAACEDiNAGI+rePUCwEIQAAC0gQQs3R7SA4CEIAABE4jgJhP6zj1QgACEICANAHELN0ekoMABCAAgdMI/B9etj40nZT7WQAAAABJRU5ErkJggg=="
}
To convert your image into base64 encode format you can use the http://www.base64-image.de/ .You can upload your image and this gives you the base64 encoded string just attach in your JSON parameter

Please note this is just an alternate solution and not the recommended approach but if there are no options left then not a bad idea to try this for small file load of attachment

2 comments:

  1. Great Article
    Image Processing Projects




    Deep Learning Projects for Final Year




    JavaScript Training in Chennai



    JavaScript

    Training in Chennai




    The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals,

    Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer.

    Angular Training

    ReplyDelete
  2. pmp certification online

    Become a Certified Project Manager with Official PMP® Training. Click here for pmp training -PMP Certification

    ReplyDelete

Introducing Lightning Base Components

Lightning Base Components are great addition to the platform and in fact revolutionary .One of the concerns around lightning component ...