I am using Salesforce.com platform. I am getting error when i am calling Rest API. Like this:

Http h = new Http();
HttpRequest req = new HttpRequest();
HttpResponse res = h.send(req);
System.debug('RESPONSE BODY'+ res.getBody());

In response I am getting following ERROR: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

My URL already CA certified. Should I do for upload this? or any solutions?

  • What is your endpoint. Is it http or https? This error comes in https based communication only. If it is https then it needs to have a certificate from CA to which salesforce trusts. Salesforce trusted CAs can be found here : developer.salesforce.com/page/… Dec 10, 2015 at 8:45
  • yes endpoint is https. my url is already CA certified but when tried to use that https url in salesforce. it is giving me error Dec 10, 2015 at 9:15
  • IMO, you will have to also send CA Certificate along with the request. Check setClientCertificateName attribute for HTTP Request Dec 10, 2015 at 11:09
  • the issue also can occur if your endpoint is certified by CA but the root certificate is not know by Salesforce. Check this salesforce.stackexchange.com/questions/68189/…
    – steals
    Dec 11, 2015 at 10:50


Your Answer

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

Browse other questions tagged or ask your own question.