0

I need to send an HTTP request to an external Server.

They need to open my permissions there and they asking for my URL OR IP address.

Since I using Salesforce and it's on the cloud, I don't know exactly how they will route my request and from which IP address the request will be sent, so I need to give them all of the IP that SF provides for whitelisting.

1. If I want to give them URL like - https://someSandboxName--sandboxName, if it possible via server - HTTP GET - is there a way to make a debug to watch exactly the URL before sending the request?

I know that sending an HTTP request via client-side (VF page for example - a form submitting - the request is including the URL of the sandbox), is that the same at the server side?

What does the other side is getting in there side? Do they get the sandbox URL?

2. If I want to give them the IP address - should I give them all the ranges? from all the areas?

This is a lot for a company to whiteList and I don't sure every company will agree to do so - security issues.

What is your suggestion?

Full list is here : https://help.salesforce.com/articleView?id=000321501&type=1&mode=1

enter image description here

  try{ 
            Http httpProtocol = new Http();
            HttpRequest request = new HttpRequest();
            String url = 'https://SomeExternalSite/webservices/Export.aspx/param?year=2020';    
            request.setEndpoint(url);
            request.setMethod('GET');
            request.setHeader('Content-Type','application/xml');

            HttpResponse response = httpProtocol.send(request);

       }catch(Exception e){

         // Do something
       }
4
  • There are apex methods to get your current URL The IP is a completely different matter. Since your post says OR, I'd suggest you get your instance and post the URL to them.
    – crmprogdev
    Jul 28, 2019 at 16:08
  • Thanks, The Url From some reason Is not working. I used - URL.getSalesforceBaseUrl().toExternalForm() to get my URL and gave it to the external service. We tried also to get the URL shorter like : Instead : Https://sandbox.cs108.my.salesforce.com I gave them : Https://sandbox But still - I getting an error of : CALLOUT_RESPONSE|[28]|System.HttpResponse[Status=Forbidden, StatusCode=403]
    – Salvation
    Jul 31, 2019 at 11:42
  • Silly question, but have you configured remote site settings for this URL? Its also possible you may need to put your params in a particular format along with other params they are expecting, including URL encoding them to go either in the body or header of your request.
    – crmprogdev
    Jul 31, 2019 at 19:12
  • Hi @crmprogdev I wrote this question again - a little differently. This is the answer of the question right here : salesforce.stackexchange.com/questions/271980/… Thanks for your help!
    – Salvation
    Aug 5, 2019 at 7:14

1 Answer 1

1
  1. As mention in this post : Get the Info of a REST API Sender by @Pranay Jaiswal - I should use the IP

  2. and for the IP address - under each IPV4 Network we could get the regions and areas that will use the range of IPs and whitelist only them - although Salesforce recommendation is to whitelist all the IPs range.

You must log in to answer this question.

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