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
MilanMilan 

Enterprise API or Partner API ?

Hello,
 
Our app is supposed to use Enterprise API and has been coded accordingly. In development and test, I would login using the Enterprise URL and use the subsequent Session Id and server URL returned to make subsequent calls. No problem there.
 
In real worlkd scenario, our app will be working as a tab in Salesforce and people will NOT be login in AGAIN to come to our functionality. We will directly recieve their server URL and session Id. We will than invoke the getUserInfo to retrieve information and identify as to who the user is, etc, etc and proceed.
 
My only question is how do I ensure that I am hitting a URL which is an Enterprise URL ? In my test , since I was manually login in to Enterprise URL , I assume that the serverURL returned by Salesforce will be an enterpriseURL. But in the real world scenario, when the user comes in, he directly passes a Server URL and Session ID, how do I know that the server URL is an Enterprise URL ?
 
Any insights will be appreciated.
 
Thanks,
Milan
SuperfellSuperfell
[Please don't cross post to multiple forums]


You can either (a) validate the URL by checking the pattern https:/*.salesforce.com/services/Soap/c/*

or (b) you can just build a new URL using the fixed path part that you know now (/services/Soap/c/9.0), and just take the protocol and server name from the passed in serverUrl.
MilanMilan

Thanks Simon,

Never thought this one would be so easy. Let me try it out.

Regards,

Milan