Scenario: Let’s assume that we
need to integrate salesforce with other 3rd party applications. This
application have tight security policy like salesforce.
Due to this you need to while list all
IP from where the request can be made to 3rd party API.
Solution: Salesforce publish a list IP
owed by them and which will be used for calling any 3rd party API.
The complete list of IP is published at
: https://help.salesforce.com/apex/HTViewSolution?id=000003652
Problem: When salesforce acquire new IP
or increase the IP range some of the Integration fail. To debug this issue you
have 2 ways.
1)Check the if there are any updates on the above link
and cross verify the IP ranges with your network team
Or
2) find out IP of your new salesforce org.
How: There are simple steps you can
follow to find the IP of your salesforce Org.
1)
Go
to http://mockbin.org/ and click create bin
2)
On
next screen also just click create bin without entering any details.
3)
Copy
The URL from any of code snippet shown for ex. http://mockbin.org/bin/84995797-d5fe-472d-bbf2-0b7ccf95170c?foo=bar&foo=baz
4)
Login
to org for which you want to find the IP
5)
Go
to setup and quick search ‘Remote Site setting’
6)
Add
http://mockbin.org in trusted site
7)
Run
following code from your developer console
8)
Then
go back to . http://mockbin.org/bin/84995797-d5fe-472d-bbf2-0b7ccf95170c
and click view history
9)
It
will show all the requests along with IP from where the request was made.
Http h = new Http();
HttpRequest req = new HttpRequest();
//Don’t
forget to replace the URL copied in step 3
req.setEndpoint('http://mockbin.org/bin/cbc071cf-851d-4b1f-8abf-3b14859bcfb6?foo=bar&foo=baz');
req.setMethod('GET');
HttpResponse res = h.send(req);
system.debug('>>' + res.getBody()
);