String endPoint = 'https://wise-otter-ngj5eu-dev-ed.salesforce.com/services/apexrest/v1/getAccounts/';
Http h2 = new Http();
HttpRequest req1 = new HttpRequest();
req1.setHeader('Authorization','Bearer ' + accessToken);
HttpResponse res1 = h2.send(req1);

String trimmedResponse = res1.getBody().unescapeCsv().remove('\\');

Error on line 10, column 1: System.CalloutException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 503 Service Unavailable" AnonymousBlock: line 10, column 1

Postman works fine, but I cant do the same with apex Postman works fine, but I cant do the same with apex

  • Hello Ivan, and welcome to SFSE (Salesforce Stack Exchange). Quick question: are you sure the endpoint is correct? I tried to open wise-otter-ngj5eu-dev-ed.salesforce.com but it failed with a DNS error. Commented Apr 8, 2022 at 14:10
  • 1
    The first thing I would check here is to see if you do actually have the Apex class with @RestResource(urlMapping='/v1/getAccounts/') in the org you're making this callout to.
    – Derek F
    Commented Apr 8, 2022 at 14:10
  • @DerekF in Postman everything is fine
    – Ivan
    Commented Apr 8, 2022 at 14:41
  • @JefersonChaves you need access token to call my apex rest, this URL for rest service , you can login with this URL wise-otter-ngj5eu-dev-ed.lightning.force.com
    – Ivan
    Commented Apr 8, 2022 at 14:45
  • Hello Ivan, thanks, but actually the endpoint on Postman is different from the code. I see the postman as wise-otter-ngj5eu-dev-ed.my.salesforce.com and the code with wise-otter-ngj5eu-dev-ed.salesforce.com (missing the .my. between dev-ed and salesforce). Suggestion: copy the endpoint from postman and update the code, try again, and report the outcome. Commented Apr 8, 2022 at 15:02

1 Answer 1


The endpoint on the code is missing .my. between the dev-ed and salesforce.

From https://wise-otter-ngj5eu-dev-ed.salesforce.com to https://wise-otter-ngj5eu-dev-ed.my.salesforce.com.

So, replace the endpoint into the code to:

String endPoint = 'https://wise-otter-ngj5eu-dev-ed.my.salesforce.com/services/apexrest/v1/getAccounts/';

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .