0
Httprequest req =new HttpRequest();
req.setEndpoint(URL.getSalesforceBaseUrl().toExternalForm()+'/services/data/v28.0/tooling/sobjects/staticresource/08190000000cgISAAY/'+'?_HttpMethod=PATCH');
req.setHeader('Content-Type','application/json');
req.setHeader('Authorization','OAuth ' + UserInfo.getSessionId());
req.setMethod('POST');
req.setBody('{ "Body":"YWxlcnQoIkhlbGxvIFdvcmxkIik0"}');
//req.setBody('{"MetadataContainerId":"1dc90000000I6VQAA0","ContentEntityId" : "08190000000cgISAAY","Body":""'+base64EncodedBody+'""}');
Http httpReq =new Http();
HttpResponse res = httpReq.send(req);
System.debug(res.getBody());
  • posting the code without any details will not help people to answer. please tell us if you are getting error or which part of the code you need help with. – Vamsi Krishna Mar 24 '15 at 11:42
0

Your Endpoint should be minus the last '/'

req.setEndpoint(URL.getSalesforceBaseUrl().toExternalForm()+'/services/data/v28.0/tooling/sobjects/StaticResource/08190000000cgISAAY'+'?_HttpMethod=PATCH');

You need to encode your body to base64

String bdy_string = encodingUtil.Base64Encode(blob.valueOf('YWxlcnQoIkhlbGxvIFdvcmxkIik0'));
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.