function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDCExplorerSFDCExplorer 

What is the difference between $Api.Enterprise_Server_URL and $Api.Partner_Server_URL

If we have to get the instance URL dynamically which one we have to use?
Daniel BallingerDaniel Ballinger
$Api.Enterprise_Server_URL will give you the Server URL to access the Enterprise API.
$Api.Partner_Server_URL will give you the Server URL to access the Partner API.

There are details for the differences between those two WSDLs in Salesforce provides two WSDL files, what are the differences? (https://help.salesforce.com/apex/HTViewSolution?id=000004760&language=en_US) In short, the Partner API is generic and can be used against all Orgs with API access. The Enterprise API is stongly typed to your current orgs schema.

You will want the merge field that corresponds to the WSDL you are consuming.

In terms of actual value, The Enterprise URL will be something like /services/Soap/c/36.0/0DF700000000001 while the Partner API will be /services/Soap/u/36.0
SFDCExplorerSFDCExplorer
Hi Daniel Ballinger,

Thank you for your response.
I need to display the record URL in one of my custom object through formula field.I tried to Use both API's and noticed that they are giving the same results.Hence which URL is prefered to give the seamless output for customers?
Daniel BallingerDaniel Ballinger
They shouldn't give you the same result. The Enterprise URL should have /c/ and the Partner URL /u/.

Since you are giving the URL out others to integrate with, I would assume you will want the Partner API URL from $Api.Partner_Server_URL. The Enterprise URL wouldn't be useful if they didn't also have the WSDL for your org.
SFDCExplorerSFDCExplorer
Hi Daniel Ballinger,

My requirement is just to display the URL like  " www.na2.salesforce.com". Just to make my formula work in multiple instances i am usings API in my custom formula.what ever the Api i am using i am achieving my requirement. But i would like to know a bit clearly that will there be any difference using in these two different API's espesially for my requirement?