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
RP@TranseraRP@Transera 

Programatically Determine a Customers SFDC Instance

We've integrated the SFDC APIs into our java applet.  What I'm trying to do is minimize the around of configuration information that we have to retain for a user. 

 

My question is there a way from the API to determine my instance?  i.e. 'na1, na2, etc.' when I build my URL to pop screens?

 

We've looking in the API and we don't see it in the user or binding objects.

 

 

This is a sample URL that were using.

 
SuperfellSuperfell
If you're calling login, then the result of that will include instance info. If you're getting launched from an scontrol or custom link, then there's a merge field available for the api server url.

BTW if you think about it, if there was an API call available that told you this, it wouldn't be useful as you need to know the instance before you can make an API call.

Message Edited by SimonF on 05-22-2006 04:07 PM

alivepjcalivepjc
Simon,
 
We have a bunch of apps that generate links to objects.The links are created with the instance na1 hard coded. the LoginResult returns the serverUrl, which is https://na1-api.salesforce.com/xxxxx.. how should we get the instance? Another thread says to use the describe call.. describe which object? parsing the url string doesn't seem like a very good idea...
 
Thank you.
SuperfellSuperfell
call describe on the object you're building a link to.
RP@TranseraRP@Transera
Where is the instance info?  We've looked in the binding object and queried the user object.  The only URL we can see is in the Binding.URL which returns:
 
 
Which isn't correct.  we are on emea.salesforce.com

"BTW if you think about it, if there was an API call available that told you this, it wouldn't be useful as you need to know the instance before you can make an API call."
 
But you don't need the instance info to login or query the user object.  I was hoping it was hanging around some place.
SuperfellSuperfell
Login is the only call you can make without knowing which instance you're on. All other calls are authenticated calls and required both (a) you send it to the right instance (b) you send it with a valid sessionId header.

If you want the URL to an object to pop the UI, then call describeSObject for the particular object type and look at the urlEdit, urlDetail, urlNew values it returns. see http://www.sforce.com/us/docs/sforce70/wwhelp/wwhimpl/common/html/wwhelp.htm?context=sforceAPI_WWHelp&file=sforce_API_calls_describeSObjects_DescribeSObjectResult.html#wp3133088
RP@TranseraRP@Transera

Thanks!  We will still have to remove the tail end of the field because it has a little extra but that's no problem at all!

VB.net example.  We have a java version too.

Dim x As sforce.DescribeSObjectResult

x = Binding.describeSObject("Case")

Debug.WriteLine("urlEdit field." & vbCrLf & x.urlEdit)